[SDL] SDL_Surface or OpenGL for graphics

Started by
1 comment, last by XTAL256 15 years, 8 months ago
I am making a 2D game using SDL. So far i have used OpenGL for the graphics because i have used it before and i initially used Win32 API for everything else before moving to SDL. But i am having a lot of problems using glDrawPixels for my map (see my posts here and here). I need one large map and i need to be able to access each individual pixel so i can do some cool particle effects (like Falling Sand Game), so i can't use an OpenGL texture. But i use textures for everything else, especially my GUI. It's very easy to draw the images, i simply draw a quad with the texture coords. This also allows my to stretch and/or tile the image with no additional coding. So given this information, do you think i should continue to use OpenGL and somehow overcome the problems i am having (maybe it has something to do with the pixel format) or is it better to use SDL's graphics routines?
[Window Detective] - Windows UI spy utility for programmers
Advertisement
Quote:Original post by XTAL256
so i can do some cool particle effects (like Falling Sand Game)


SDL isn't hardware accelerated and neither is using glDrawPixels(). Generally you should avoid glDrawPixels or anything that directly accesses the screen pixels because it slows things down a lot.

Have you tried using glPoints for all the little dust pixels? You can store your pixel offsets in VBOs.

Learn to make games with my SDL 2 Tutorials

Quote:Original post by Lazy Foo
SDL isn't hardware accelerated

Oh, isn't it? I thought it used DirectX on Windows, or maybe that was Allegro.
I don't know what VBOs are although i saw a tutorial on it at NeHe. It sounds like a good idea but i think it would be better if i worked entirely on pixels, that way i can make huge amounts of dirt fall down with no extra memory needed. For example, a player can shoot their laser into a mountain destroying all pixels in it's path and making the whole mountain collapse. In this case i would only move each pixel down rather that using complex fluid dynamics formulas.
If it is better to use OpenGL then i think i will just split the map up into smaller textures, it will be harder to work across multiple textures but it's going to be hard anyway, so...
[Window Detective] - Windows UI spy utility for programmers

This topic is closed to new replies.

Advertisement