Jump to content
  • Advertisement
Sign in to follow this  
isbinil

OpenGL, oh my god

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

Was trying to port my game from SDL2's unoptimized immediate mode to something more efficient (vertexArrays, VBO).... But guys, after two days i already gave up. Why the heck is OpenGL such a nightmare ??

 

- clean documentation is impossible to find

- 5000 ways of doing the same thing in more or less confusing ways

- shaders ?? i just want to display a bunch of batched 2D textures...

- most tutorials are outdated or focus only on a small part of the problem

 

 

Please, can you suggest me a way of doing modern 2D rendering without having my brain explode ?

I'm using C, with SDL2 for everything (input, audio, events...) which is nice except its rendering part which is a bit outdated

Edited by isbinil

Share this post


Link to post
Share on other sites
Advertisement

Learning a framework or something big like OpenGL C api can be TREMENDOUS work. 

Take the time to learn the new openGL 3.0 api. 

Make small changes to your project, for example don't switch to programmable shaders until you finished transforming to using VBO's with VAO.

 

I'd even advise to rewrite everything, if it's too hard (Limited resources) then take the first suggestion. 

 

If you are not that needy, try refactoring using SFML. It basically can handle things for you. 

Share this post


Link to post
Share on other sites

Was trying to port my game from SDL2's unoptimized immediate mode to something more efficient (vertexArrays, VBO).... But guys, after two days i already gave up. Why the heck is OpenGL such a nightmare ??

 

- clean documentation is impossible to find

- 5000 ways of doing the same thing in more or less confusing ways

- shaders ?? i just want to display a bunch of batched 2D textures...

- most tutorials are outdated or focus only on a small part of the problem

 

 

Please, can you suggest me a way of doing modern 2D rendering without having my brain explode ?

I'm using C, with SDL2 for everything (input, audio, events...) which is nice except its rendering part which is a bit outdated

 

Because OpenGL like DIrectx is no longer using a fixed pipeline, and swapped to a programmable pipeline, you must use shaders to render everything now. This includes applying textures to models. This is not exclusive to OpenGL, DirectX also does this.

 

The general rule of thumb is that you're required to have a Vertex shader (which transforms everything from world space to screen space at the most basic level), and a fragment shader (which handles the process of actually drawing things to the screen.)

 

This might seem stupid, but it's actually really efficient. The same shader can be reused a thousand times over.

So when you now render an object, you bind data to resource buffers,including textures and then send the render call. This is what allows us to do batching so well. And a lot of other neat tricks.

Share this post


Link to post
Share on other sites

I feel your pain.

 

Modern OGL is really more for 3D games. That's what the big boys make and that's what the graphics cards are designed to make. So doing 2D games with it is kind of awkward to say the least.

 

Quite frankly, you might benefit from learning 3D game programming in order to do your 2D projects if you want to do OGL. Because really that's what a 2D game is in OGL these days: a 3D game that simulates 2D.

 

SDL might kind of help you without getting into 3D if 2D is truly what you want to do. But as far as pure OGL, you need to get a solid understanding of 3D before you can do 2D, which is kind of counter intuitive and against conventional wisdom.

 

But what you're really doing in OGL is making 3D quads to represent 2D sprites and using an orthographic projection matrix instead of a perspective projection matrix.

 

Modern OGL is 3D. So you need to learn 3D in order to do 2D in modern OGL.

 

Once you understand 3D in OGL, 2D should be relatively simple. I know that's against conventional wisdom, but it's just the way it is. 2D is an after thought on modern graphics cards. 2D is just a confined way of doing 3D as far as modern graphics cards are concerned.

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!