Blitting on top of an OpenGL surface?

Hello list,

I have a game I’m working on where I need to draw the HUD on top of the
active game using OpenGL. How can I accomplish this? I’d like to use
the SDL_BlitSurface function to do so if possible. Any help would be
much appreciated. Thanks.

~Graham

Graham Wihlidal wrote:

Hello list,

I have a game I’m working on where I need to draw the HUD on top of the
active game using OpenGL. How can I accomplish this? I’d like to use
the SDL_BlitSurface function to do so if possible. Any help would be
much appreciated. Thanks.

Look into the SDL_OPENGLBLIT flag for SDL_SetVideoMode(). You might
consider using OpenGL to render the hud as well, as you gain free scaling,
and resolution independence.> ~Graham


tarquin - John Allensworth
Programmer, Loki Software

I have a game I’m working on where I need to draw the HUD on top of the
active game using OpenGL. How can I accomplish this? I’d like to use
the SDL_BlitSurface function to do so if possible. Any help would be
much appreciated. Thanks.

Use
SDL_SetVideoMode( … , SDL_OPENGLBLIT );
instead of
SDL_SetVideoMode( … , SDL_OPENGL );

And then you can use SDL_BlitSurface. However, this method is REALLY
REALLY REALLY REALLY REALLY slow.

You should be a real man and just use OpenGL itself to render the HUD.

–ryan.

Oy… Something tells me the documentation sorely needs to be updated about
this little flag. Do not use SDL_OPENGLBLIT. PERIOD. It abuses the
texture-uploading API and will reduce your game’s fps dramaticially. What
you want to do is bind your surface as an OpenGL texture and use glOrtho to
align it on a quad properly.

See this mailing list message for a better, more OpenGL friendly method:
http://www.libsdl.org/pipermail/sdl/2001-September/039017.html

Anybody know if they’ve got a FAQ setup for this yet? It’s pretty sorely
needed…On Wed, Dec 12, 2001 at 06:59:37PM -0800, John Allensworth wrote:

Graham Wihlidal wrote:

Hello list,

I have a game I’m working on where I need to draw the HUD on top of the
active game using OpenGL. How can I accomplish this? I’d like to use
the SDL_BlitSurface function to do so if possible. Any help would be
much appreciated. Thanks.

Look into the SDL_OPENGLBLIT flag for SDL_SetVideoMode(). You might
consider using OpenGL to render the hud as well, as you gain free scaling,
and resolution independence.


Thomas “Mondoshawan” Tate
@Thomas_Mondoshawan_T
http://tank.dyndns.org

Look into the SDL_OPENGLBLIT flag for SDL_SetVideoMode(). You might
consider using OpenGL to render the hud as well, as you gain free scaling,
and resolution independence.

Oy… Something tells me the documentation sorely needs to be updated about
this little flag. Do not use SDL_OPENGLBLIT. PERIOD. It abuses the
texture-uploading API and will reduce your game’s fps dramaticially. What
you want to do is bind your surface as an OpenGL texture and use glOrtho to
align it on a quad properly.

The docs have been updated. People just don’t read them. As long as the
SDL_OPENGLBLIT flag exists to be used, someone is going to use it thinking
they can do it easier using SDL_BlitSurface. You’d think the hordes of
people screaming not to use it every single time someone suggests or asks
about it would be enough to convince people on the list to stop suggesting
it at least.

See this mailing list message for a better, more OpenGL friendly method:
http://www.libsdl.org/pipermail/sdl/2001-September/039017.html

Anybody know if they’ve got a FAQ setup for this yet? It’s pretty sorely
needed…

IIRC, there isn’t yet (I didn’t look, don’t take my word for it), but
there is testgl.c which quite explicitly says that SDL_OPENGLBLIT is a
very, very bad idea.On Wed, Dec 12, 2001 at 08:55:33PM -0700, Thomas Mondoshawan Tate wrote:


Joseph Carter Free software developer

it’s 6am. I have been up 24 hours
Wake me up and risk life and limb.

  • Knghtbrd &; sleep
    Okay everyone, we wait 10 minutes and then start flooding Knghtbrd
    with ^G’s. Someone, hack root and cat /dev/urandom >/dev/dsp.

-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 273 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20011212/35408dfe/attachment.pgp