PDA

View Full Version : It just won't draw



Robin
04-13-2000, 03:26 AM
Hi, I am a beginner to the OpenGL stuff and I've got a small but tricky problem. I'm probably missing something obvious, and I apologise if the answer is in a FAQ somewhere....anywho, here we go.

The problem is getting the window to refresh, ie. update the image, when I want it to. I know the code is working resonably well because changing the size of the window causes the new image to be displayed.

I just can't get it to happen without user intervention.

I'm using GLUT on Irix (a unix-type thing) and also Linux (SuSE) in various versions.

Here is my display callback:

void display(void)
{
/* Clear all pixels */
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glDrawPixels(width, height, GL_RGB, GL_UNSIGNED_BYTE, image);
glutSwapBuffers();
glFinish();
}

The glutSwapBuffers and glFinish calls are just my desparate attempts to get it to work. Double buffering is not vital and I'll be happy to do without it....

Can somebody help me??? Please!!!!

PS. I AM using glutPostRedisplay at the point where I want the display updated (just after the image array has been filled in).

b1st
04-13-2000, 09:08 AM
Actually, I have the exact same problem!

I try to refresh the screen after mouse input using glutPostRedisplay(), it just draws right over what's already there. But if I minimize it and then expand it, it refreshes.

Someone please help http://www.opengl.org/discussion_boards/ubb/frown.gif

dmy
04-13-2000, 11:00 PM
if you need to do continuous animation, then tell glut to use display as idle function also:

glutIdleFunc(Display);

or something like that. i don't use glut in a while.

also, there's not the need to call glFinish(), swapbuffers implicitely does it yet, and if there's no back buffer glutSwapBuffer won't prevent things to work properly.

Dolo/\/\ightY

[This message has been edited by dmy (edited 04-14-2000).]