Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Ronin Magus

Useful for 2d?

This topic is 5863 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

Howdy, I was wondering if I oughtta take the time to learn to program OpenGL if all I really ever want to do is 2d graphics, such as tile engines and scrollers. Is it worth the time or should I learn another API? How coherent is OpenGL when compared to DirectX, understandability-wise? http://www.icarusindie.com/roninmagus

Share this post


Link to post
Share on other sites
Advertisement
Well, DirectDraw is probably better suited for 2d, but OGL can handle it just fine through the use of Orthographic projection. I''m not sure how easily it would be to do side-scrollers or tile games, but I was able to make a Pong clone after about a month or two of reading tutorials and hanging around the boards.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
If your goal is to eventually get into 3D after learning 2D I suggest starting with OpenGL.

The reason behind this line of though is that the API doesn''t change when going from 2D to 3D with OpenGL but it does in DirectX.

So, it''s rather up to you.
They both do equally well at 2D and 3D IMO.

Share this post


Link to post
Share on other sites
I love doing 2d in OGL I personally think its a lot better then direct draw. I hated using direct draw and plus its my understanding directdraw in not hardware accelerated at all but if you use OGL you will get 3d hardware acceleration.

Share this post


Link to post
Share on other sites
Direct Draw is a nice little API contrary to what others may say. Although I''ll note that the COM aspects of DirectX do take a little bit of getting used to, consider it a growing pain.

OpenGL does have the ability to render in Ortho mode which basically allows you to do 2d in the 3d API. However there are benefits and costs to each of these.

Direct Draw has no hardware support for alpha blending, limited hardware support for rotation and scaling is usually done in software also. On the benefits size your image sizes can be any dimension, and direct draw is also supported on alot better on more video cards than OpenGL is. One of the most glaring benefits of Direct Draw for beginners is the simplicity of the mathmatics needed to make a game with direct draw. A tad bit of physics knowledge, some geometry, and possibly a tad bit of trig and your up and running. Another benefit is the direct draw clipper which solves the problem of drawing things that are not on screen.

OpenGL on the other hand has image size limitations for your textures. All textures must be a power of 2, this does not mean 10x10. It means 2,4,8,16,32,64 and so on, these are powers of 2. Also a limitation you''ll run into when dealing with 3dfx''s Voodoo Cards is that you can''t have a texture that is over 256x256. And another note is that a single texture 4096x4096 at 32bit color should effectively take up all 64 megs of your video ram (uncompressed). OpenGL requires a higher level knowledge of mathmatics to honestly really understand what''s going on. This includes what''s called "Linear Algebra", things like matricies are used to represent every object on the screen so it''s very beneficial to know how to make a rotation/scaling matrix with out the use of the glRotate() and glScale() functions. Other problems you run into when you enter the third dimension is the requirement to manually manage your scene with something similar to a scene graph to allow you to avoid drawing what is not shown in the screen. However OpenGL does support hardware support for Alpha Blending, rotation and scaling.

Final words:
If you''ve got a limited math background go with Direct Draw, after the initial setup it''s real easy to use. Otherwise you might consider a 3d API like OpenGL. Game programming is hard enough without compounding your learning an API and expanding your current knowledge base into the third dimension.

Share this post


Link to post
Share on other sites
Well, evaclear summed that up quite nicely.



I know only that which I know, but I do not know what I know.

Share this post


Link to post
Share on other sites
quote:
Original post by evaclear
and direct draw is also supported on alot better on more video cards than OpenGL is.


this is the only bit I really take any issue with, anything since the Nvidia TNT card (so we are talking since late 1998) has excellent support for OGL, and I dare say most of ATi''s cards (certainly the more recent ones) also have excellent support for OGL.

Your only really gonna hit hastle if you are worried about pre-hardware acc. gfx cards which only did 2D support
as pretty much anything in the last couple of years supports OGL in hardware.

Also, there has been talk about using 3D APIs for 2D games as it speeds them up some more and takes advantage of 3D hardware.

Also, the way you worded the part about the texture using up all the ram might be a bit misleading, as you have put it down with the OGL bad sides, however ANY API (be it DX, DD or OGL) storeing a texture that size without compression is gonna use up all the video RAM, and you''d be mad not to use compression anyways as it speeds things up no end.


Other than that, pretty much agree with everything else

Share this post


Link to post
Share on other sites

  • 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!