OpenGL + SDL

Started by
11 comments, last by Acharis 11 years, 8 months ago
JTippets answered a similar question here. Just because you need something 'pixel perfect' does not mean you cannot involve textures.
Advertisement
If you want pixel perfect rendering, just remember that when polygons rasterize they rasterize to the center of the pixel. If you wanted to draw a line from 0 to 5 inclusive, you draw from 0.5 to 5.5.

Try setting up your ortho projection matrix and then translate it <0.5, 0.5, 0.0> to center your pixels.

Learn to make games with my SDL 2 Tutorials


JTippets answered a similar question here. Just because you need something 'pixel perfect' does not mean you cannot involve textures.
Hmmm, very interesting. I thought 3D cards do not provide such capability and the exact accuracy depends on the card used. If textures can be used then indeed it's very nice performance wise.

OK, so now it's mostly convenience question. Is there a way to use BOTH OpenGL (for 3D) and SDL_Blit (for primitive 2D overlay), so I don't need to rewrite my already existing SDL code?

Also, I would like to understand how exactly opening screen/context/canvas works? A screen is a screen, it should be a buffer on GFX card VRAM which should be usable the same way by all APIs. What exactly happens when I define the screen as "SDL_OPENGL" and why can't I use normal SDL Blits then?

Stellar Monarch (4X, turn based, released): GDN forum topic - Twitter - Facebook - YouTube

This topic is closed to new replies.

Advertisement