Fast 2D with OpenGL

Started by
19 comments, last by MetalFox 23 years, 1 month ago
glDrawPixels is usually not optimized by OpenGL implementors, so it''s slow. You should use textures and draw quads with Orthogonal projection.

There is a Linux game that does exactly what you are trying to do. It has stunning visuals and great speed with with my Geforce2 MX card. The game is called Chomium B.S.U and you can find it here: http://www.reptilelabour.com/software/chromium/ . Source code is available so you can study it and find out how it works.
Advertisement
DirectDraw is just a toy in a box that is very hard to open.
It is not just that OGL has a fillrate that is several times higher it is also much more powerful. OGL lets you use all of the latest hw features DirectDraw does not.

You can not do it in the old blit style but have to do it like a 3D app.
Direct3D 8 will give you the best performance and some nice helper librarys to deal with 2D. DDraw has lots of very nice functions, but it might be slower and harder to use. OpenGL has no sprite / 2D related helper functions and 2D graphics of GL is awful slow. The textured quad approach works, but D3D8 is simply more comfortable to handle and also faster in this area.

I would still say that GL is the worst choice for a 2D game. While is has some andvantages and disadvantages over D3D in 3D, it has only disadvantages when it comes to 2D...

Tim

--------------------------
glvelocity.gamedev.net
www.gamedev.net/hosted/glvelocity
Tim--------------------------glvelocity.gamedev.netwww.gamedev.net/hosted/glvelocity
If D3D8 should give you better performance than OGL do it have to support some hardware features that OGL does not. This is not the case. The alternative is that D3D8 has better drivers and that debate more belongs in a D3D vs OGL thread.

Sure, the helper functions sounds good but I do not know what is available for OGL.
No, this was by no means a flame against GL. I know all three APIs (DDraw7, OpenGL, D3D8), and I like them all. Ok, maybe I dislike DDraw7 a bit, but anyway ;-)

And, Direct3D8 is faster for 2D sprites, there are some things you cant do in OpenGL because of how the API works... Also, it is simply better to code for. Because of the build in sprite lib, the support for point sprite, and the build in font engine etc.



Tim

--------------------------
glvelocity.gamedev.net
www.gamedev.net/hosted/glvelocity
Tim--------------------------glvelocity.gamedev.netwww.gamedev.net/hosted/glvelocity
the point is it''s for XWINDOWS!!!!No crappy microsoft directx.

Anyway try drawing with bitmapped GL_QUADS...should work fine.
He could always use the SDL if he wanted. It uses OpenGL when in Linux, so it could handle all the annoyances you may have with using a 3D API for 2D.

I personally like OpenGL for 2D. I don''t like to use helper functions, except for the basic glVertex type of things that OpenGL provides. I like to load files with my own code, I like to write my own editors, scripting languages, et cetera.

"Finger to spiritual emptiness underlying everything." -- How a C manual referred to a "pointer to void." --Things People Said
Resist Windows XP''s Invasive Production Activation Technology!
http://www.gdarchive.net/druidgames/
OGL sucks for 2D, that''s a fact, not an opinion. DirectX is not crappy, XW is crappy because it doesn''t have anything else than GL...

Tim

--------------------------
glvelocity.gamedev.net
www.gamedev.net/hosted/glvelocity
Tim--------------------------glvelocity.gamedev.netwww.gamedev.net/hosted/glvelocity
well i think directdraw sux for 2d graphics. it has no blending or rotation capabilities. opengl is quite slow though in 2d i admit my vanta sometimes even drops below 150fps whilst doing 2d.

i read tcs about your moving of house and new job, nice one i hope it works out. health tip - drink lots of barvarian beer

http://members.xoom.com/myBollux
OGL IS slower and it IS more work than D3D when you use it for 2D, sorry, I don''t say this to annoy anyone, it''s simply a fact I learned over time ;-)

I don''t like Bavaria, but my job and my new apartment are very very cool. And my coworkers are also very nice, we have a lot of fun. Was a good decision to move here. I can program the whole day and I learn A LOT...

Tim

--------------------------
glvelocity.gamedev.net
www.gamedev.net/hosted/glvelocity
Tim--------------------------glvelocity.gamedev.netwww.gamedev.net/hosted/glvelocity

This topic is closed to new replies.

Advertisement