2D OpenGL - Best approach

Hullo :slight_smile:

I’m finally getting around to getting some hardware 3d acceleration and I was
just wondering if someone could give me a tip for doing some 2D stuff.

Normally in a 2D game you’d just make use of SDL_BlitSurface() but you can’t
do that with OpenGL, can you?

So what’s the best thing to do? Bind textures to quads and pop them onto the
screen…?

Oh… this isn’t entirely off topic since I’m still intending on using all the
SDL libs for most other stuff :slight_smile:

Stevie :slight_smile:

Yeah that’s how i do it, draw quads to the screen w/ sprite textures on em.

i also use glOrtho() to set ortho mode.> ----- Original Message -----

From: stephen.sweeney@parallelrealities.co.uk (Stephen Sweeney)
To:
Sent: Thursday, May 19, 2005 3:17 PM
Subject: [SDL] 2D OpenGL - Best approach

Hullo :slight_smile:

I’m finally getting around to getting some hardware 3d acceleration and I
was
just wondering if someone could give me a tip for doing some 2D stuff.

Normally in a 2D game you’d just make use of SDL_BlitSurface() but you
can’t
do that with OpenGL, can you?

So what’s the best thing to do? Bind textures to quads and pop them onto
the
screen…?

Oh… this isn’t entirely off topic since I’m still intending on using all
the
SDL libs for most other stuff :slight_smile:

Stevie :slight_smile:


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

So, would it be a just a case of loading my image as usual using SDL,
converting them over to OpenGL textures and then using the textures in place
of the loaded PNGs, etc when it comes to drawing my sprites…?

Any other tips you could give me?

Stevie :)On Friday 20 May 2005 00:09, Alan Wolfe wrote:

Yeah that’s how i do it, draw quads to the screen w/ sprite textures on em.

i also use glOrtho() to set ortho mode.

Stephen Sweeney wrote:

Any other tips you could give me?

Use these to get the same looking alpha blending that software SDL uses.
I had to look a long time to find those.

glBlendFunc( GL_SRC_ALPHA , GL_ONE_MINUS_SRC_ALPHA );
glEnable( GL_BLEND );