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 2 of 2

Thread: Texture Mapping Problem

  1. #1
    Junior Member Newbie
    Join Date
    May 2011
    Posts
    26

    Texture Mapping Problem

    The texture is mapping oddly to the cube in OpenGL, but it looks just fine in the OBJ format. The U/V Coordinates are identical, I think. Do U/V Coordinates have to be formatted a little differently for OpenGL than for OBJ files?

    Click image for larger version. 

Name:	Texture_Problem.jpg 
Views:	199 
Size:	9.1 KB 
ID:	1053

    Here is the source code:
    http://www.maco64.com/f/Cube_Texture_Problem.c

    Here is the OBJ version:
    http://www.maco64.com/f/Cube.obj
    http://www.maco64.com/f/mtl.mtl

    Here is the texture that is used by both:
    http://www.maco64.com/f/texture2.bmp

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,117
    Code :
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);

    try GL_REPEAT not GL_CLAMP. Clamp clamps to range 0-1 but your UV range from -0.5 - +0.5


Posting Permissions

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