Question

When I load an image, the next image loaded for something else is the same image.

Basically:

I'm making a Pong replica and there is a texture for the paddle and for the ball (yes I have made sure that they are both different). You can find the source code here. The paddle loads an image fine, but when it comes to the ball it loads the same exact image as the paddle (Paddle = Paddle.cpp , Ball = Ball.cpp).

What could possibly be wrong with it? Am I using SOIL incorrectly?

Was it helpful?

Solution

From source: glBindTexture(PadImg , GL_TEXTURE_2D);

This is way wrong, it should be glBindTexture(GL_TEXTURE_2D, PadImg);

You should get familiar with glGetError, it will help you find problems like this.

Also, these calls are in the wrong order:

glVertex2f(-w,-10);
glTexCoord2f(0,0);

glVertex should always be the last function called per vertex (normals and texcoords come first).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top