PDA

View Full Version : Vertex Array Object



fgiannon
12-12-2003, 01:27 AM
Actually this is my in-engine code to draw batches of polygons with OpenGL, it does'n work enabling lighting or texture coords...I cant't understand why, can anyone help me? Thank you!
PS: this is the ATI path for that adpters that have not the support for Vertex Buffer Objects like mine mobile ATI Radeon 9000...

if(glBindBufferARB)
{
...
}
else if(glArrayObjectATI)
{
// Enable vertex buffer
for(DWORD i=0; i<m_Attributes.size(); i++)
{
// Get current attribute
iVertexBuffer::iAttribute *pAttribute = &pVertexBuffer->m_Attributes[i];
// Active requested texture stage with multitexture extension
if(pAttribute->Semantic==GL_TEXTURE_COORD_ARRAY)
glClientActiveTextureARB(GL_TEXTURE0_ARB+pAttribut e->Index);
// Enable client state and associate to it an array object
glEnableClientState(pAttribute->Semantic);
glArrayObjectATI(pAttribute->Semantic, pAttribute->ElementCount, pAttribute->Type, 0, pVertexBuffer->m_ID, pAttribute->Offset);
}
// Enable index buffer
glEnableClientState(GL_ELEMENT_ARRAY_ATI);
glArrayObjectATI(GL_ELEMENT_ARRAY_ATI, 1, GL_UNSIGNED_INT, 0, pIndexBuffer->m_ID, 0);

// Draw triangles
glDrawElementArrayATI(GL_TRIANGLES, pBatch->m_IndexCount);

// Disable all setted client state
glDisableClientState(GL_ELEMENT_ARRAY_ATI);
for(i=0; im_Attributes.size(); i++)
{
iVertexBuffer::iAttribute *pAttribute = &pVertexBuffer->m_Attributes[i];
if(pAttribute->Semantic==GL_TEXTURE_COORD_ARRAY)
glClientActiveTextureARB(GL_TEXTURE0_ARB+pAttribut e->Index);
glDisableClientState(pAttribute->Semantic);
}
}