! New question at bottom !
I've been wanting to draw a quad and have it textured, but this seems to be a larger struggle than I first thought it would of been.
I create my quad and they appear nicely on the screen, in a plain white colour... which is the problem, I can't change that. (Well I can, but I don't know how), Things might me a bit messy because I've been trying alsorts of things on it. Even read the Specifications, but that doesn't really help me on how it operates as a whole.
The code is inside a function and is passed a Vector and a Texture
At the bottom I do infact recieve a error of GL_INVALID_ENUM
const GLdouble vertex_buffer[] = {
(position.x / windowSizeHalf.x) - 1, (position.y / windowSizeHalf.y) - 1, position.z,
((position.x + tex.width) / windowSizeHalf.x) - 1, (position.y / windowSizeHalf.y) - 1, position.z,
(position.x / windowSizeHalf.x) - 1 , ((position.y + tex.height) / windowSizeHalf.y) - 1, position.z,
((position.x + tex.width) / windowSizeHalf.x) - 1, ((position.y + tex.height) / windowSizeHalf.y) - 1, position.z
};
const GLint uv_buffer[] = {
0, 0,
1, 0,
1, 1,
0, 1
};
unsigned int VertexBufferObject[1];
unsigned int UVBufferObject[1];
glEnable(GL_TEXTURE_2D);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glClientActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, tex.textureID);
glGenBuffers(1, UVBufferObject);
glGenBuffers(1, VertexBufferObject);
glBindBuffer(GL_ARRAY_BUFFER, *UVBufferObject);
glBufferData(GL_ARRAY_BUFFER, 8 * sizeof(unsigned int), uv_buffer, GL_STATIC_DRAW);
glTexCoordPointer(1, GL_INT, 0, 0);
glBindBuffer(GL_ARRAY_BUFFER, *VertexBufferObject);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertex_buffer), vertex_buffer, GL_STATIC_DRAW);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_DOUBLE, GL_FALSE, 0, 0);
glEnableVertexAttribArray(1);
glEnableVertexAttribArray(0);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glBindVertexArray(0);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisable(GL_TEXTURE_2D);
GLenum error = glGetError();
if(states.RENDERING_DEBUGGING && error != GL_NO_ERROR)
logError((char*)glewGetErrorString(error));
return;
Thank you for any help