What is the best way to render sprites with 3.2? (for GUI and the likes)
I am currently storing multiple sprites in a single texture.
This is how I used to do it:
-load list of sprites (x,y,w,h,texid) from txt file.
-draw_sprite(sprite* spr, x,y)…
–pushmatrix
–translate(x,y)
–render quad with coords/texture coords according to spr.
–popmatrix
This is how I am thinking of doing it:
-load one texture holding sprite graphics
-load one texture holding sprite info (x,y,w,h)
-send uniform with sprite info index
-send uniform with sprite pos
-render a vbo containing one quad corners (0,0) and (1,1)…
–vertex shader scales and translates points and calcs uv’s
–fragment shader looks up sprite texture
I presume that a more clever solution might exist, so pointers a most welcome