Sluggish OpenGL performance using Win32

Started by
13 comments, last by Alex Melbourne 11 years, 9 months ago
easy fix for the exit problem...


for(;;)
{
if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
if(msg.message == WM_QUIT)
break;

TranslateMessage(&msg);
DispatchMessage(&msg);
}
else
{

glClear(GL_COLOR_BUFFER_BIT);

glColor3f(0.0f, 0.0f, 0.0f);
glBegin(GL_TRIANGLES);
glVertex2f( 0.5f, 0.5f );
glVertex2f(-0.5f, 0.75f);
glVertex2f(-0.35f, -0.4f );
glEnd();

glViewport(0, 0, 800, 600);

glFinish();
}
}
Advertisement
Just to add... you won't get a lot of help with single buffering or glFinish, simply because nobody ever uses it!

[quote name='phantom' timestamp='1341791443' post='4957078']Any reason you DONT want double buffering anyway?


Not in the slightest. When learning stuff in the past, I've had a tendency to move far to fast and begin stumbling over further topics that I lack any grounding in. I've got the first copy of OpenGL 1.0 and I've done the first 6 chapters (I need to go back over lighting though). The only reason I'm ignore any use of buffers is that I simply haven't learnt it yet.
[/quote]

I have to comment on this because there's actually nothing to learn with double-buffering. Just make sure that you set PFD_DOUBLEBUFFER and call SwapBuffers at the end of the frame - that's it. OpenGL tutorials that create single buffered contexts may give you the misguided impression that a double-buffered context is somehow more complex or needs more work; it's not.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.


Just to add... you won't get a lot of help with single buffering or glFinish, simply because nobody ever uses it!

Not exactly. It is used quite often in multi-threaded rendering setups to signal that resources are no longer being used by the GPU (among other things).


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

easy fix for the exit problem...


Yeah, it occurred to me that the break statement suddenly becomes an exit from the message loop by not the containing loop.

This topic is closed to new replies.

Advertisement