Off-Topic Discussion > Programming

Finally starting to learn OpenGL

(1/2) > >>

Flipside:
Been meaning to start learning OpenGL for ages and a few weeks ago I started dipping my toe into it to learn 2D coding in LWJGL for the purpose of testing out some ideas I had.

It's actually a lot less difficult than it is daunting. I think the problem is an awful lot of tutorials are either 3D-Centric, which is probably a big first step for someone who hasn't multiplied a matix in decades, and whilst I can still remember how to calculate COS/SIN/TAN from triangles, I never quite got my head around how to manipulate equations to use them to their potential. I've always sucked at reducing equations to their simplest form. 2D isn't so bad, and oddly enough, I grew up using the top-left coordinate system on computers and have always had to mentally convert to bottom-left, so in some ways, 2D is actually easier for me in OpenGL.

I think the problem with a lot of OpenGL tutorials is that they start at 'how it works', which seems like a logical thing to do until you see the wall of text and charts explaining the inner workings of something you're not even sure you are going to use yet, that's been enough to put me off for a long time.

The E:
Another problem with the online tutorials I found is that quite a lot of them are still based around OpenGL 2 and do not cover the new OpenGL API as introduced with OpenGL 3 and 4.

Flipside:
Yup, still threading my way through the minefield of FBO's and VBO's, and what they are for, or whether it's worth using a shader for simple multiplication-based 2D lighting, which reduces engine stress, but involves learning yet another new sub-language set-up. Part of me says, 'yes, do a shader, you don't know how many entities you'll be cycling through later and how busy the CPU will end up being', the other, more lazy part of me thinks 'sod it, how much of a performance hit are 2D Graphics going to be anyway?'.

I could theoretically do what I am doing with Java's Graphics2D system and its built-in OpenGL acceleration, but I'm basically trying to cut out the middle-man for the sake of performance, but its slow going because you usually have to refer to 3-4 sources to get a decent idea of how to adapt code to your own needs.

Edit : I will add that one other problem I face is that the tutorial I'm using is based on a 2D Tower Defence game, which is moderately removed from what I am planning, so as the tutorials progress, the percentage of them that is relevant to what I am doing is becoming smaller and smaller, it's become more of a reference for 'what to look for tutorials on' rather than a tutorial itself.

The E:
I strongly recommend learning the ins and outs of shaders (and especially OpenGL 3). The extra effort you have to put into learning GLSL (and there isn't much, if you're writing Java, most of the Syntax will already be familiar to you) pays off in many, many ways. Also note that it doesn't matter that much whether you do 2D or 3D graphics these days; modern hardware (and, more importantly, modern drivers) are all focussed on shader performance, and so going down that route will make everything much less complicated.

Flipside:
Been looking through things, the downside to a shader is that FBO's aren't very frequent update compatible, so I'm rendering the main texture to the main window in live mode, though the Menus etc may well make it to a buffer.

I'm assuming that the best way to do things is to enable the shader, draw the textures with the shader applied, turn off the shader and check to see for updates to non-lighting windows like the menus etc?

I'm thinking of a FBO as a kind of 'JPanel' type thing, so I hope I'm getting the right idea.


Navigation

[0] Message Index

[#] Next page

Go to full version