[SDL] SDL, OpenGL, and Drawing only part of the screen
Ryan C. Gordon
icculus at icculus.org
Sun Oct 8 15:25:27 PDT 2006
> I was thinking about using glViewport to only draw to part of the screen
> but I still have to use SDL_GL_SwapBuffers();. to make the changes visible.
>
> Is there a way I can only refresh part of the screen?
glViewport doesn't work like that...generally you redraw the whole frame
each time and swap the buffers (which is different than how a 2D app,
which benefits from less drawing, works).
If you have even basic hardware acceleration and can reasonably ask if
there's a way to avoid drawing parts of the screen, OpenGL is _not_ your
bottleneck! You might be hitting a slow path (use a display list instead
of immediate mode, for example), or there's something you can optimize
in the application itself (if you have 100 things to draw and you know
that 99 of them are off screen, only draw the one instead of having
OpenGL cull it for you).
--ryan.
More information about the SDL
mailing list