Hiya. I’ve just started on the red book, and when trying the first GLUT example I don’t get any rendering. The new window is not blank, it displays whatever was behind the window when it was created.
I’m running FreeBSD 6.0, Xorg, and WindowMaker. OpenGL is enabled in xorg.conf (the OpenGL screensavers in xscreensaver work fine).
The source (a modified version of hello.c) compiles and links without errors, and liberal calls to glGetError() haven’t showed any errors. A few printf() lines were added to the display() function to test that it’s really being executed (it is).
Any help would be greatly appreciated.
Just yell if any other info is needed to diagnose. (source? output of glxinfo? screen capture?)
ETA: I found older, similar topics suggesting that it’s a driver issue, but is that possible since other OpenGL applications still work?
The source code might be useful to have a look at.
Thanks for the quick response, Mikael.
Here’s the source:
#define CHKERR if (glGetError() != GL_NO_ERROR) printf("oops
glColor3f(1.0, 1.0, 1.0);
glVertex3f(0.25, 0.25, 0.0);
glVertex3f(0.5, 0.75, 0.0);
glVertex3f(0.75, 0.25, 0.0);
printf(" display(): FLAG
glClearColor(0.0, 0.0, 1.0, 0.0);
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
int main(int argc, char** argv)
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
This was compiled with:
cc -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lGL -lGLU -lXext -lglut -ohello hello.c
I also tried leaving out various libs, once with only glut. All with the same result.
Works fine for me on XP with msvc 6.
Thanks for the heads up Zenix. It’s good to get confirmation that it isn’t the code.
So has anyone else seen this transparent window thing? While configuration advice would be more directly applicable from Linux/BSD users, I could certainly use some pointers from the Windows/Mac people that have seen something similar.
i suppose that your window is not really transparent. if you move it around,
its contents stays the same, right? it seems that the window buffer is not updated when you call
glFlush(). what happens when you create a double-buffered window (don’t forget to call
Yes, that’s exactly right. Also, whenever a window is dragged in WindowMaker the coordinates of the window are displayed. These display boxes, like the background, “stick” in the opengl window instead of disappearing after dragging is complete. Here’s a jpg of the single buffer, “transparent” window .
There are a bunch of “display(): FLAG” lines of output while dragging, so it looks like the display() function is being called for each new coordinate box.
I tried a double buffered window with the following changes:
< glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
> glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
I don’t get a blank window anymore, which is good, but instead I get a solid magenta window , which is not good even though I’m happy to see a new side of the problem.
BTW, for the double buffered case, the coordinates displayed by the window manager disappear after dragging is complete, as expected. The opengl window is “correctly” redrawn as completely solid magenta.
i’ve finally managed to install GLUT, and i’m almost sorry that i have to say: it works!
i compiled the first version that you posted, with a single buffer, and i get a white triangle
on a blue background. the problem does not seem to be in your code.
what does glxinfo say? are there any other programs on your computer, which use opengl and run
correctly, e.g. glxgears?
I’m having the exact same problem with my program for a Graphics assignment, and have been trying everything to get something drawn. The double buffering doesn’t seem to have any effect on mine.
All of the OpenGL screensavers in xscreensaver work fine, as does glxgears, so it seems like whatever I’m missing is probably something small and easy to fix.
Here is my output from glxinfo and from glxgears -info . I notice that GLUT isn’t mentioned anywhere, even though these are present:
/usr/X11R6/lib/libglut.so -> libglut.so.3
Does that mean something is off with just the GLUT installation? The package libglut-6.0.1 was automatically installed as a requirement for xscreensaver, so I think I’ve got a handle on what to look for.
I’ll update if I can get it working.
Quick update, in case anyone else is having the same problem.
According to a few relevant threads from the FreeBSD lists, the problem is that DRI must be enabled .
Here are a few useful places to check out:
DRI Wiki - Building
DRI on BSD
ATI Mobility Radeon 9600 driver
Direct rendering is now enabled, and everything works fine!