Jump to content
  • Advertisement
Sign in to follow this  
space warp

OpenGL Alternatives to VGA

This topic is 4239 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I'm currently working on a small 2D-game (nothing fany, just a tank game to teach myself a thing or two) and I need a good way to blit the screen in fullscreen and high speeds. My current program is using GDI and it never gets above 17 fps. The only thing I can think of at the moment is the somewhat elaborate way of creating an OpenGL window in fullscreen, making an orthogonal viewport, setting up a plane to fill the viewport, creating a texture the same size as the screen, puting the texture onto the plane and then modyfing the texturedata in order to change the screen. And I have no idea how to do the last three things, or if it will work at all. So, does anyone know a good way to do the above? Or maybe a good alternative? /space warp

Share this post


Link to post
Share on other sites
Advertisement
Don't use a single texture that represents the screen but several textures that represent single objects and tiles. So you build your level from ground tiles, wall tiles, etc. as well as tank objects, and so on.

If you used render-to-texture you'd have to do this anyway (or something similar), so omit the render-to-texture step and directly render to the back buffer. I also assume you're using something similar to render with GDI so just port that to OpenGL or DirectX.


Using GDI means drawing everything in software which can be really slow. Using OpenGL or DirectX will employ hardware and thus will speed up things a lot!

Share this post


Link to post
Share on other sites
GDI isn't that hot performance wise. IMHO you've got two choices - switch to a better 2d API, or go the 2d-through-3d route with OpenGL or D3D. For the first, something like SDL would probably be a good choice. IIRC it uses DirectDraw under the hood so drawing speeds should be somewhat quicker. Or if you go the GL route, then load your sprites as textures and draw them as individual textured quads (not by updating a big texture as you mentioned). Very fast and lots of flexibility for rotating, scaling, etc.

All this assumes you're actually drawing sprites and not doing something crazy like drawing the individual pixels yourself by hand. If you're doing that you might want to try Pixel Toaster.

Share this post


Link to post
Share on other sites
Move right away from GDI and move into a real graphics API such as OpenGL or Direct3D.

From there, you need to rewrite your entire rendering engine to use these APIs. Instead of using a GDI/OpenGL hybrid, get rid of GDI completely. From there you can render your textures straight to the backbuffer, and you won't need to go through the process of copying texture data back and forth.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!