I am trying to make a .png image as a texture. However, all that is displayed is a white square.
I give my texture a unique int identifier, called texID, that reads pixeldata into the buffer image (declared in the .h file). I load my pixelbuffer, do all my OpenGL stuff and bind this pixelbuffer to a texture for OpenGL. Then I draw everything using glDrawElements.
I also initialize a 32x32 texture when I call its constructor, so I doubt that it is related to the power of the two-size problem.
Can anyone see errors in my OpenGL installation GL_TEXTURE_2D that can give me a white square block.
#include "Texture.h" Texture::Texture(int width, int height, string filename) { const char* fnPtr = filename.c_str();
I will also include the main init 'init, where I will install OGL a bit before this.
void init(void) { printf("\n......Hello Guy. \n....\nInitilising"); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0,XSize,0,YSize); glEnable(GL_TEXTURE_2D); myBlock = new Block(0,0,offset); glClearColor(0,0.4,0.7,1); glLineWidth(2);
Update: adding to the main function, where I first installed the OpenGL window.
int main(int argc, char** argv) { glutInit(&argc, argv);