GLUT on Linux

Hi there everyone,

I haven’t been able to find a way for GLUT to draw on an existing Window or Drawable in X. Does anyone know how I would be able to take an existing Drawable like a GDKwindow or just a plain Window and draw on it using GLUT?

-Leo

Glut is NOT used for drawing, but is a simple to use display management system (display in X terms of course, handling windows, kb and mouse events).

You can use either OpenGL or Xllib calls to draw to your window, but of course you must have the correct graphic context ( GC ).

Using Glut for ALL the window handling takes care of most of this for you.

There are other toolkits as well you may wish to check out (see the title of this forum!)

Or I am missing something fundamental about your question???

Rob.

Well, I am using GLUT to interact with another toolkit that I don’t know about. All I know is that I have an interface method that is going to receive a Drawable (XID). The Drawable or Window probably was not created with a GLX context. __glutCreateWindow is nice enough to create a GLX context for me, but I already have the window and do not want another one. I am to draw on the one I currently have. For some reason, I am unable to do this. I get BadWindow errors.

-Leo

If I understand you correctly, your other toolkit has created a window, but it does NOT have the correct context for you to draw OpenGL onto it? So, you want to use GLUT to create the window with the right context, and then pass this window to you other toolkit.

If I am right, I would think this is really not a good way to proceed. You really should create the window in the original toolkit with the correct context.

Perhaps you can change the GC of the original window using XChangeGC()

Just an idea.

Rob.

Ahhh!!! Change the graphics context. That sounds exactly like what I want to do.

Thanks,
-Leo