PDA

View Full Version : Drawing texture tiles it 3x3



petemyster
12-14-2012, 04:15 PM
I am importing my own .raw file and creating a texture from it. When I draw it on the screen it appears to be tiled 3x3 and I don't know why. Can anyone help me out?

Here is what is shown:
http://i.imgur.com/DDPba.png
And here is the texture I am importing:
http://i.imgur.com/rABr7.jpg


void RenderScene() {

// Clear Color and Depth Buffers
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

//reset view
glLoadIdentity();

//set up view to camera
gameCamera->MoveGLView();

glEnable( GL_TEXTURE_2D );

glBindTexture( GL_TEXTURE_2D, texture );

double test = 1;

glBegin( GL_QUADS );

glTexCoord2d(0.0, 0.0); glVertex2d(0.0, 0.0);
glTexCoord2d(test, 0.0); glVertex2d(1.0, 0.0);
glTexCoord2d(test, test); glVertex2d(1.0, 1.0);
glTexCoord2d(0.0, test); glVertex2d(0.0, 1.0);

glEnd();

glFlush();
}

And the code I'm using to import the texture from a .raw file
http://www.opengl.org/discussion_boards/showthread.php/179975-Creating-Texture2d-from-a-byte-array?p=1245777&viewfull=1#post1245777

tonyo_au
12-14-2012, 06:11 PM
This code look fine - it will not render more that one copy. Are you sure the original image is only a single copy?

petemyster
12-15-2012, 10:23 AM
This code look fine - it will not render more that one copy. Are you sure the original image is only a single copy?

Thanks for the reply. I don't know whats up. I downloaded a .raw file from the internet and the image is displayed correctly. Something must have gone wrong in my end when I was exporting my image to .raw

That's ok though, as long as it works! Thanks again.