PDA

View Full Version : Beginner with a question.



Bill Dean
09-17-2003, 05:33 PM
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

cg-hci_novice
09-17-2003, 09:28 PM
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?

cg-hci_novice
09-17-2003, 09:29 PM
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?

Bill Dean
09-19-2003, 12:08 PM
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

Deiussum
09-19-2003, 03:07 PM
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.

Bill Dean
09-20-2003, 10:03 AM
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

09-20-2003, 03:32 PM
Try using the glutSwapBuffers(); at the end of your render function.

cg-hci_novice
09-21-2003, 07:31 AM
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.

Bill Dean
09-21-2003, 01:12 PM
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

mikael_aronsson
09-21-2003, 11:05 PM
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).

Mikael

Deiussum
09-22-2003, 04:30 AM
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. http://www.opengl.org/discussion_boards/ubb/smile.gif (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

Display:
Default Monitor on Intel(R) 82845G/GL Graphics Controller.

Bill Dean
09-22-2003, 02:10 PM
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

Bill Dean
10-03-2003, 08:41 AM
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