Original Post
I am having trouble mapping a texture to a surface. I know that the class I wrote to load the image is working correctly because I can display the image by using glDrawPixels(). However whenever I try to bind the texture object, set the texture filters, and specify the texture for the texture object nothing is mapped to the surface when it is rendered. here is the code I used to load the texture and create the textre object is there anything i am missing?
[source lang='cpp']
tgaImage.loadTGAImage("test2.tga");
glDrawPixels(tgaImage.getImageWidth(), tgaImage.getImageHeight(), GL_BGR_EXT, GL_UNSIGNED_BYTE, aImage.getImageData());
//GLuint grassTexture;
glGenTextures(1, &grassTexture);
glBindTexture(GL_TEXTURE_2D, grassTexture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, tgaImage.getImageWidth(),
tgaImage.getImageHeight(), 0 , GL_RGB, GL_UNSIGNED_BYTE,
tgaImage.getImageData());
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
//glDrawPixels(tgaImage.getImageWidth(), tgaImage.getImageHeight(), GL_BGR_EXT, GL_UNSIGNED_BYTE, tgaImage.getImageData()); displays the image correctly