I’m having a bit of trouble and can’t seem to find the issue.
I’ve been going off of NeHe’s tutorials mostly (minus using glaux of course) but i wanted to switch from glbegin/end to gldrawarrays but I cant seem to get it right
here’s my draw function
int DrawGLScene(GLvoid)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, WinData.Size.x(), WinData.Size.y(), 0,-1.0f, 1.0f);
glTranslatef(pos.x(),pos.y(), 0.0f);
GLfloat vertices[] = {0,0,spriteSize.x(),0,spriteSize.x(),spriteSize.y(),0,spriteSize.y()};
GLfloat texVertices[] = {0,0, 1,0, 1,1, 0, 1};
glEnableClientState(GL_VERTEX_ARRAY);
glBindTexture(GL_TEXTURE_2D, texture[0]);
glVertexPointer(2, GL_FLOAT, 0, vertices);
glTexCoordPointer(2, GL_FLOAT, 0, texVertices);
glDrawArrays(GL_QUADS, 0, 4);
glDisableClientState(GL_VERTEX_ARRAY);
All i get is a black, blank texture…On the other hand…this code works:
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f); glVertex3f(0.0f, 0.0f, 1.0f);
glTexCoord2f(1.0f, 0.0f); glVertex3f( spriteSize.x(),0.0f, 1.0f);
glTexCoord2f(1.0f, 1.0f); glVertex3f(spriteSize.x(),spriteSize.y(), 1.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f(0, spriteSize.y(), 1.0f);
glEnd();
Any help would be awesome, thanks