Hi,
I need to draw allot of 2D quads with textures. therefore i decided to use VBO and shaders.
For each quad i’m sending
- 4 vertexes - the same value (2[xy] * 4[vertexes]) (The vertex shader will transform the vertexs using the vertex attribute)
- Color (4[rgba] * 4[vertexes])
- textures coord (2[xy] * 4[vertexes]
- Vertex Attribute - factors for the shader to expand the points to quad (2[xy] * 4[vertexes])
I made it happened and its works great. but there are allot of repeating data that i want to skip like color for each vertex, or the same 4 vertexes for quad.
Now what i’m trying to do is to use geometry shader to creates this quads. Sending him single points and letting him create a triangle strip which will look like (“Quad”).
This way i will save for each quad
- 3 vertexs (3[xy] floats - Sending only one)
- 3 colors (3[rgba] * 3[vertexes] - Sending only one)
made it happen as well - works great - although same performances. but less memory which is good for me.
long story, i’m sorry
and now the problem:
How can i send for single point 4[xy] (8 floats) texture coordinates and 4[xy] (8 floats) vertex attributes?
is it possible ?
For the attributes i made 4 arrays of each factor (topleft, topright, bottomright, bottomleft) but i guess there is an easier way.
thanks.