@@ -269,13 +269,25 @@ void RenderTarget::draw(const Vertex* vertices, std::size_t vertexCount,
269
269
vertices = NULL ;
270
270
}
271
271
272
+ // Check if texture coordinates array is needed, and update client state accordingly
273
+ bool enableTexCoordsArray = (states.texture || states.shader );
274
+ if (enableTexCoordsArray != m_cache.texCoordsArrayEnabled )
275
+ {
276
+ if (enableTexCoordsArray)
277
+ glCheck (glEnableClientState (GL_TEXTURE_COORD_ARRAY));
278
+ else
279
+ glCheck (glDisableClientState (GL_TEXTURE_COORD_ARRAY));
280
+ m_cache.texCoordsArrayEnabled = enableTexCoordsArray;
281
+ }
282
+
272
283
// Setup the pointers to the vertices' components
273
284
if (vertices)
274
285
{
275
286
const char * data = reinterpret_cast <const char *>(vertices);
276
287
glCheck (glVertexPointer (2 , GL_FLOAT, sizeof (Vertex), data + 0 ));
277
288
glCheck (glColorPointer (4 , GL_UNSIGNED_BYTE, sizeof (Vertex), data + 8 ));
278
- glCheck (glTexCoordPointer (2 , GL_FLOAT, sizeof (Vertex), data + 12 ));
289
+ if (enableTexCoordsArray)
290
+ glCheck (glTexCoordPointer (2 , GL_FLOAT, sizeof (Vertex), data + 12 ));
279
291
}
280
292
281
293
// Find the OpenGL primitive type
@@ -390,6 +402,8 @@ void RenderTarget::resetGLStates()
390
402
if (shaderAvailable)
391
403
applyShader (NULL );
392
404
405
+ m_cache.texCoordsArrayEnabled = true ;
406
+
393
407
m_cache.useVertexCache = false ;
394
408
395
409
// Set the default view
0 commit comments