I’m trying to use OpenGL in a .NET program, and everything’s fine except
that I get almost a one second pause when glBegin is called, whether it
be called directly or as part of a vertex list. I’ve been looking around
and can’t find a reason. Might anyone here have a clue?
I’m initializing openGL with:**********************
screen = Video.SetVideoModeWindowOpenGL(width, height, true);
Sdl.SDL_GL_SetAttribute(Sdl.SDL_HWSURFACE, 1);
Sdl.SDL_GL_SetAttribute(Sdl.SDL_GL_DOUBLEBUFFER, 1);
Gl.glShadeModel(Gl.GL_SMOOTH);
Gl.glClearColor(bgColorR, bgColorG, bgColorB, 0.0f);
Gl.glClearDepth(1.0);
Gl.glEnable(Gl.GL_DEPTH_TEST);
Gl.glDepthFunc(Gl.GL_LEQUAL);
Gl.glHint( Gl.GL_PERSPECTIVE_CORRECTION_HINT, Gl.GL_NICEST );
Gl.glViewport( 0, 0, width, height );
Gl.glMatrixMode( Gl.GL_PROJECTION );
Gl.glLoadIdentity();
Glu.gluOrtho2D(win_left_edge,win_right_edge,win_bottom_edge,win_top_edge);
Gl.glMatrixMode( Gl.GL_MODELVIEW );
Gl.glLoadIdentity();
and then I draw with this:
Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT);
Gl.glLoadIdentity();
Gl.glTranslatef(0.0f,0.0f,0.0f);
Gl.glEnable(Gl.GL_TEXTURE_2D);
Gl.glBegin(Gl.GL_QUADS); // Draw A Quad
Gl.glTexCoord2d(0.0, 1.0);
Gl.glVertex2i(-(int)(currentImgWidth/2),-(int)(currentImgHeight/2));
// Bottom Left
Gl.glTexCoord2d(1.0, 1.0); Gl.glVertex2i(
(int)(currentImgWidth/2),-(int)(currentImgHeight/2)); // Bottom
Right
Gl.glTexCoord2d(1.0, 0.0); Gl.glVertex2i( (int)(currentImgWidth/2),
(int)(currentImgHeight/2)); // Top Right
Gl.glTexCoord2d(0.0, 0.0); Gl.glVertex2i(-(int)(currentImgWidth/2),
(int)(currentImgHeight/2)); // Top Left
Gl.glEnd(); // Done Drawing The Quad
Gl.glFlush();
Sdl.SDL_GL_SwapBuffers();
or in one section I use glCallList, but that acts exactly the same. The
only thing i could think of is that maybe I’m missing some attributes to
set via SDL_DL_SetAttribute or something.
Also, I know that there is another way to flip the buffers via the Video
class (I forget the call right now), is there any difference between
that and SDL_GL_Swap_Buffers? If someone can help. that would be great,
this is an emergency now!