Original Post
Hello, I have a class "renderer" that renders all my sprites: It has a std::vector that stores pointers to all textures. You can add a texture with renderer::addTexture(Texture*). In the main loop you call renderer::draw(). But it doesn't work well (actually it doesn't work at all :D).
void Renderer::draw()
{
for(int i=0; i<gfxList.size(); i++)
{
glBindTexture(GL_TEXTURE_2D, gfxList->getData());
glBegin( GL_QUADS );
glTexCoord2f(0.0f, 0.0f); glVertex3f(0, 0, 1); //yes the coordinates are static, but it's just for the moment
glTexCoord2f(1.0f, 0.0f); glVertex3f(1, 0, 1 );
glTexCoord2f(1.0f, 1.0f); glVertex3f(1, 1, 1 );
glTexCoord2f(0.0f, 1.0f); glVertex3f(0, 1, 1 );
glEnd();
}
}
Texture::getData() returns the GLuint.
Renderer gameGraphics;
Texture tex;
gameGraphics.addTexture(&tex);
...
gameGraphics.draw();
If I run this code, only the quad is displayed, but the actual texture is missing. I guess everyone is facepalming right now :D Thanks.