PDA

View Full Version : GLUT under Linux



przybylski
07-12-2002, 11:39 AM
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

07-12-2002, 09:54 PM
The normal use for GLUT is to setup some window that you can use for OpenGL rendering. If you already have a window with OpenGL capabilties why do you want to use GLUT? What exactly should GLUT be used for?

I guess my answer is "No, just configure the window with GLX for OpenGL rendering".

przybylski
07-13-2002, 06:59 AM
Well, I just have a Window or Drawable (XID) and it is not configured for GLX. I want to use it in place of __glutCurrentWindow->win. I try to create a GLUTwindow and make it the current window and then set __glutCurrentWindow to whatever Drawable or Window I have from an interface and I get some unexpected results.

I would just like to take a Window or Drawable passed in from the interface.

The reason I am using GLUT is it is cross-platform and lightweight.

Based-on the above, should I still look into GLX for configuring my Window?

Thanks in advanced,
-Leo

07-13-2002, 10:27 PM
You can not use any window for OpenGL rendering and you must also have a OpenGL context, see the man page for glXIntro for a overview. The only way I know of to get a OpenGL window is to create it the right way.

From the GLX 1.2 spec.
"In GLX the definition of Visual has been extended to include the types, quantities and sizes of the ancillary buffers (depth, accumulation, auxiliary, and stencil)."
and
"Ancillary buffers are associated with a GLXDrawable, not with a rendering context. If several OpenGL renderers are all writing to the same window, they will share those buffers. Rendering operations to one win- dow never affect the unobscured pixels of another window, or of the corresponding pixels of ancillary buffers of that window."

This page has a lot more information http://toolbox.sgi.com/linux/Guide/Picks/

przybylski
07-14-2002, 12:07 PM
Thank you very much.

przybylski
07-15-2002, 08:44 AM
Is it possible to change the attributes of an exiting window to be configured for GLX?

-Leo

Rob Fletcher
07-17-2002, 12:34 AM
Hi,

XChangeGC() ?????????????

Rob.

07-17-2002, 01:10 AM
I think that the window should have a visual that supports OpenGL. From the second chapter of Xlib Programming Manual (O'Reilly & Associates, Inc.)
" It may clarify the picture to describe the features that window attributes do not affect. Setting the window attributes does not determine the size or position of a window, its parent, or its border width; these comprise the window configuration. Setting the window attributes does not affect the depth, class, or visual of a window; these are permanently set when the window is created. Attributes do not determine how graphics requests are interpreted; this is the job of the graphics context (GC)."

The book is online here http://capderec.udg.es:81/ebt-bin/nph-dweb/dynaweb/SGI_Developer/XLib_PG/