OpenGL 3 and 4 problems?

Started by matanui159, August 17, 2014, 01:13:25

Previous topic - Next topic

matanui159

I'm making a 2D game engine (cause 3D was one two many axes ;D ) and I thought I might upgrade it to OpenGL 3 and 4 because apparently its 'better'.

I haven't started yet because I found a bit of a problem...
My 'Sprite' class has four properties for color: red, green, blue and alpha.

And with OpenGL 3 and 4 you have to provide the color first up in your VAO.
So how do I keep the color 'live'?

With vertices, I can just have a VAO with the width and height of 1, then I just transform, rotate and scale it.

But for color, I have heard of glBufferSubData and the OpenGL docs for glBufferData also have a GL_STREAM_DRAW mode.
So that gives me two options but I thought it would make it slow using one of these methods every frame, which is definitely not what I want.

So, can someone help me get some things straight?
ALGORITHM
A word used by programmers when they do not want to explain what they did.

WEE :)

Cornix

why dont you test it and see whether its going to be slow or not?

By the way, whenever you think about performance of VBO's, remember that with immediate mode you needed to send the exact same data every frame. You were just splitting it up across multiple function calls. So in the worst worst case its going to be as fast as immediate mode.

Always remember to do bulk-updates. Never upload only a few bytes.