SBTTrueType help with Modern OpenGL?

Started by goosejs, June 08, 2016, 02:28:21

Previous topic - Next topic

goosejs

Hi, I am currently working on a voxel based game and got to one of the parts I have not been looking forward to as I've always had trouble with it in the past, font rendering. I have been trying to get the demo's from the LWJGL github to run, and while I can get them to run, I can't for the life of me port them over to modern OpenGL using shaders and VBO's / VAO's. I am still kinda new to OpenGL, so any help would be appreciated!

EDIT: I forgot that another big issue I was having while porting it over, is generating the VAO data for the string every time and uploading that data. Uploading the data is fairly inefficient if I remember correctly so doing that every frame can't be good. I was also wondering about a better way to do this.

quew8

STB's TrueType stuff is for creating font textures and giving you the texture coordinates for a specific character. This is completely independent of how you render it so porting to modern OpenGL really should not be a problem if you have already got drawing textures quads up and running. Hence I'm guessing you haven't and so I'd focus on that to begin with.

As for shaders, VAOs and VBOs, there general, simplified purposes are these:
VBOs store raw data.
VAOs describe how to interpret that raw data into vertices and primitives. Ie. describe pointers.
Shaders turn those vertices and primitive descriptions into pixels.

So there is really no reason to be re uploading VAOs for rendering different strings. The data itself will change but how you interpret it should not be changing. So if you are re uploading VAOs you are definitely doing something wrong.

Beyond this general help, we can't do much without you posting any code.