Texture mapping in OpenGL

This is a discussion on Texture mapping in OpenGL within the Game Programming forums, part of the General Programming Boards category; Okey dokes, well I have texture mapping working and all but I'm trying to texture map a rectangle (with a ...

  1. #1
    Semi n00b Mithoric's Avatar
    Join Date
    Jun 2003
    Posts
    293

    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
    Semi n00b Mithoric's Avatar
    Join Date
    Jun 2003
    Posts
    293
    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
    Semi n00b Mithoric's Avatar
    Join Date
    Jun 2003
    Posts
    293
    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, 03:09 AM
  2. OpenGL texture mapping with texCoordArray
    By nempo in forum Game Programming
    Replies: 1
    Last Post: 08-24-2008, 05:00 AM
  3. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 01:34 PM
  4. Texture mapping in OpenGL
    By Dragon in forum Game Programming
    Replies: 5
    Last Post: 10-19-2003, 10:47 AM
  5. OpenGL texture mapping problems.
    By KnightSword in forum Game Programming
    Replies: 2
    Last Post: 07-12-2002, 11:26 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21