Thread: Texture mapping in OpenGL

  1. #1

    Texture mapping in OpenGL

    Okey dokes, well I have texture mapping working and all but I'm trying to texture map a rectangle (with a rectangular image) but I can't seem to get it working. . . ie the the texture is all screwed and skewed.

    Code:
    glBegin(GL_QUADS);
    glTexCoord2f(0.0f,0.0f);
    glVertex3f(-9.0f,0.0f,0.0f);
    glTexCoord2f(1.0f,0.0f);
    glVertex3f(9.0f,0.0f,0.0f);
    glTexCoord2f(1.0f,1.0f);
    glVertex3f(9.0f,9.0f,0.0f);
    glTexCoord2f(0.0f,10.0f);
    glVertex3f(-9.0f,9.0f,0.0f);
    glEnd();

  2. #2
    Buh, I figured it out! I was specifying the wrong dimensions for my texture.

    Ahh well, now I have another texturing problem. .. It's upside down ..

  3. #3
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    >> glTexCoord2f(0.0f,10.0f);

    i assume that was your problem....

    >> It's upside down

    you could rotate the quad or perhaps reverse your vertical texture coords to draw it right side up.

  4. #4
    Yeah, I just flipped my texture in photoshop.

    Oh, and I was only using number higher than 1 because 1 didn't work because of my mistake in not specifying the right image dimensions.

    Thanks anyway.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Texture mapping anomaly opengl
    By Shakti in forum Game Programming
    Replies: 1
    Last Post: 04-11-2009, 02:09 AM
  2. OpenGL texture mapping with texCoordArray
    By nempo in forum Game Programming
    Replies: 1
    Last Post: 08-24-2008, 04:00 AM
  3. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  4. Texture mapping in OpenGL
    By Dragon in forum Game Programming
    Replies: 5
    Last Post: 10-19-2003, 09:47 AM
  5. OpenGL texture mapping problems.
    By KnightSword in forum Game Programming
    Replies: 2
    Last Post: 07-12-2002, 10:26 PM