Beginner with a question.

I have a C++ program which uses OpenGL to
render a simple scene. It runs properly on a
workstation (UNIX) I sometimes have access to. When trying to it on a PC (Windows),it compiles without error but the viewing window opens with no image. Only when I use the mouse to resize the window does the image appear. As soon as I release the mouse button the image again is lost. The program does not take input from the mouse or even the keyboard. If anyone can suggest what the difficulty might be I would certainly
appreciate it very much. Thanks in advance. Bill

Do your problems have to do with command line args in Vis C++? Guessing that is what you are using to compile/run this app?

Do your problems have to do with command line args in Vis C++? Guessing that is what you are using to compile/run this app?

Many thanks to cg-hci_novice for responding to my question. I am running my program on
Microsoft Visual C++ (6.0), and am not using a command line directly. Rather, I am using
the automatic build and execute options in
the Build menue. As I understand it, activating these options causes an automatic
series of commands to be issued for the
compiling and running of the program. I
think you are suggesting to me that somehow
these commands are the source of the problem.
When I was running the program successfully
on a workstation I was compiling and running
it from a command line. As a true beginner I
have not figured out yet how to run the
program form a command line on the Visual C++ platform I am now using. Perhaps once I do I will find the problem resolved. So this is what I am now attempting to figure out.
Again, thanks for your help and I would be
grateful for any further suggestions you
might offer. Bill Dean

I doubt it’s a problem with how you compile the code. Some more information is needed, however.

  1. What do you use to create the window? Since you say you compile it on UNIX, I assume you use something like glut, SDL, etc.

  2. Are you using a single-buffered window? It sounds kind of like the scene isn’t getting refreshed on the initial display update, but then on subsequent ones it is.

  3. What are you using for a video card? My work computer has an Intel graphics chip, and was displaying behavior like you describe due to it not appearing to handle single-buffered windows well.

My thanks to Deiussum for responding to my
question. I am using glut to create a single-
buffered window. The computer I am using is a Dell PC, but I don’t know what type of video card it has (I will ask a colleage
about this on Monday.) I tried specifying a double buffer (glutInitDisplayMode(GLUT_
DOUBLE|GLUT_RGB)), but then the window
which opens is empty (without even the white background) and the image does not appear as before when resizing the window with the
mouse. Again thanks, and I would
appreciate very much any further ideas you
might have on a solution. Bill Dean

Try using the glutSwapBuffers(); at the end of your render function.

Sounds like Deissium knows specifically what your problem you asked about it.

For future reference, though, if you ever need to run command line args using vis c++, I have found it easiest to do from the command line prompt (DOS mode) from the dir in which the exe is located.

My thanks to Jarred Capellman, cg-ci_novice,
and Deiussum for assisting me with this
question. I tried adding glutSwapBuffers()
at the end of the function which describes
the surface I am rendering; also tried
adding this command at the end of the
display() function and at the end of main(), but the problem persists. I will be trying to get some more information on the video
card tomorrow. Thanks again, Bill Dean

Go to the Control Panel and start the Display app, usually you can see what kind of hardware you have in there (at least the GPU).


Try switch to double buffered and use the glutSwapBuffers at the end of the display function only. If this doesn’t work, you can also setup an idle function and do a glutPostRedisplay() so that it will update continuously. Come to think of it, I may have even run into this problem with my Intel chip with double buffered apps. Either way, I haven’t been too impressed with their OpenGL implementation and wish I could come up with a good excuse for needing an nVidia card for work. (I technically don’t work with OpenGL at work, but I sometimes work on some of my home projects at work a bit.)

If you go to your display panel, the settings tab, you’ll see something like

Default Monitor on Intel® 82845G/GL Graphics Controller.

This latest suggestion of Deiussum’s (a
switch to double buffer and using
glutSwapBuffers() at the end of the display
function) has worked. My sincere thanks to him and to Mikael Aronsson, cg-hci_novice,
and Jarred Capellman for working out this problem and supplying other useful
information to me. Hope I will learn enough
to someday return the favor to others in
the discussion group. Bill Dean

I have found that calling glFlush() at the end of the display function also works to
solve the problem. In reading the OpenGL
Programming Guide (3rd Ed. Woo et. al.) I
found (p.34) a discussion of using glFlush
to force sending of a network packet from
the client machine. Realizing that the
machine I am using is part of a network, I
tried this, and indeed the image was drawn
promptly. My thanks again to all those who
helped me sort this out. Bill Dean