Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Drawing texture tiles it 3x3

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2012
    Posts
    4

    Drawing texture tiles it 3x3

    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:

    And here is the texture I am importing:


    Code :
    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_boa...=1#post1245777

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,106
    This code look fine - it will not render more that one copy. Are you sure the original image is only a single copy?

  3. #3
    Junior Member Newbie
    Join Date
    Dec 2012
    Posts
    4
    Quote Originally Posted by tonyo_au View Post
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •