Code: Select all
const int VertCount = 4; // Rectangle
const GLfloat Vertex2f [] =
{
drawRect.x1, y1,
drawRect.x2, y1,
drawRect.x2, y2,
drawRect.x1, y2,
};
const GLfloat TexCoord2f[] =
{
drawRect.left, drawRect.top, // Top
drawRect.right, drawRect.top, // Right
drawRect.right, drawRect.bottom, // Bottom
drawRect.left, drawRect.bottom, // Left
};
glEnable (GL_TEXTURE_2D);
glBindTexture (GL_TEXTURE_2D, TexSlot);
// size (Specifies the number of coordinates per array element), type (GL_FLOAT, etc), stride, pointer
glTexCoordPointer (2, GL_FLOAT, 0, TexCoord2f);
glEnableClientState (GL_TEXTURE_COORD_ARRAY);
glVertexPointer (2, GL_FLOAT, 0, Vertex2f);
glEnableClientState (GL_VERTEX_ARRAY);
glDrawArrays (GL_TRIANGLE_FAN, 0, VertCount); // First, count
glDisableClientState (GL_VERTEX_ARRAY);
glEnableClientState (GL_TEXTURE_COORD_ARRAY);
Thoughts?
And if not, I'm sure I'll eventually self-solve and post answer.