VBO no dibuja nada
Estoy intentando dibujar un cuadrado con VBO en mi aplicación nativa para blackberry 10. Mi implementación es,
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_TEXTURE_2D);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glGenBuffers(1,&decompressTileImage->VBOId);
glBindBuffer(GL_ARRAY_BUFFER,decompressTileImage->VBOId);
glBufferData(GL_ARRAY_BUFFER,sizeof(tileCoordList)+sizeof(tileTextureCoordList),0,GL_STATIC_DRAW);
glBufferSubData(GL_ARRAY_BUFFER,0,sizeof(tileCoordList),tileCoordList);
glBufferSubData(GL_ARRAY_BUFFER,sizeof(tileCoordList),sizeof(tileTextureCoordList),tileTextureCoordList);
glTexCoordPointer(3, GL_FLOAT, sizeof(tileTextureCoordList), (void*)sizeof(this->tileCoordList));
glVertexPointer(3, GL_FLOAT, sizeof(tileCoordList), 0);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glDisable(GL_BLEND);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisable(GL_TEXTURE_2D);
swapBuffers();
Aquí tileCoordList contiene las coordenadas para el cuadrado y tileTextureCoordList contiene la textura correspondiente.tileCoordList
es unSquare3D
estructura tipo
typedef struct
{
Vertex3D lowerLeft;
Vertex3D lowerRight;
Vertex3D upperLeft;
Vertex3D upperRight;
}Square3D;
typedef struct
{
GLfloat x;
GLfloat y;
GLfloat z;
} Vertex3D;
4 Vertex3D
representa un cuadrado en tileCoordList. Lo mismo vale paratileTextureCoordList
. Puedo dibujar bien sin el VBO sin embargo. Estoy usando opengl-es 1.1
Otra pregunta.
Si creo dos VBOs. Supongamos que enlazé el primero con su ID, copié los datos y los dibujé. Y luego viene el segundo y también lo ato, copio los datos y los dibujo. Ahora, si quiero dibujar el primero de nuevo, ¿necesito atarlo de nuevo? Si necesito volver a enlazar, ¿debo copiar los datos en el búfer para ese VBO también?