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

Thread: Problem importing .obj / .mtl (exported using blender) into my OpenGL view

Hybrid View

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2012
    Posts
    7

    Problem importing .obj / .mtl (exported using blender) into my OpenGL view

    Hi,

    i have a problem when trying to import a blender-generated .obj/.mtl into my OpenGL view.

    The problem is the that the textures are not how they should be.

    I append a picture of the object in my Opengl view and how it is displayed in blender.
    If you want i can upload my code, just tell me which part you need.

    I tried to fix / understand this for a long time, but as im only starting with openGL...
    i THINK it is a problem with negative texture coordinates. Still im not sure how to handle it.




    # Blender v2.63 (sub 0) OBJ File: 'quad_UV.blend'
    # www.blender.org
    mtllib quad_UV.mtl
    o Cube
    v 1.000000 -1.000000 -1.000000
    v 1.000000 -1.000000 1.000000
    v -1.000000 -1.000000 1.000000
    v -1.000000 -1.000000 -1.000000
    v 1.000000 1.000000 -0.999999
    v 0.999999 1.000000 1.000001
    v -1.000000 1.000000 1.000000
    v -1.000000 1.000000 -1.000000
    vt 0.000000 0.000000
    vt -0.000000 -1.000000
    vt 1.000000 -1.000000
    vt 1.000000 0.000000
    vt -1.000000 0.000000
    vt 0.000000 1.000000
    vt -1.000000 1.000000
    vt 1.000000 1.000000
    vt -1.000000 -1.000000
    usemtl Material_BrownBrickWall_tileable.jpg
    s off
    f 8/1 7/2 6/3
    f 5/4 6/1 2/2
    f 6/4 7/1 3/2
    f 4/1 3/5 8/6
    f 5/4 1/3 8/1
    f 4/1 1/4 3/2
    f 5/6 8/7 6/1
    f 1/1 5/6 2/5
    f 2/1 6/6 3/5
    f 3/1 7/6 8/8
    f 8/6 1/4 4/1
    f 1/1 2/2 3/9
    # Blender MTL File: 'quad_UV.blend'
    # Material Count: 1
    newmtl Material_BrownBrickWall_tileable.jpg
    Ns 96.078431
    Ka 0.000000 0.000000 0.000000
    Kd 0.640000 0.640000 0.640000
    Ks 0.500000 0.500000 0.500000
    Ni 1.000000
    d 1.000000
    illum 2
    map_Kd BrownBrickWall_tileable.jpg


  2. #2
    Intern Contributor
    Join Date
    Aug 2011
    Posts
    76
    Quote Originally Posted by fp13__ View Post
    Hi,

    i have a problem when trying to import a blender-generated .obj/.mtl into my OpenGL view.

    The problem is the that the textures are not how they should be.

    I append a picture of the object in my Opengl view and how it is displayed in blender.
    If you want i can upload my code, just tell me which part you need.
    Did you try to load your obj and mtl file into another program, which you trust and believe works correctly? Does it work? If it works, then your code is wrong. And if it's wrong, why don't you post your code here? How should we see what is wrong with your code, if we cannot see your code? You know that you can download source code for these obj-loaders, various places right? If you download a few and find one that works then all you have to do, is to compare the code that works with your code that doesn't work. Shouldn't be too difficult.

  3. #3
    Junior Member Newbie
    Join Date
    Sep 2012
    Posts
    7
    Quote Originally Posted by newsb View Post
    Did you try to load your obj and mtl file into another program, which you trust and believe works correctly? Does it work? If it works, then your code is wrong. And if it's wrong, why don't you post your code here? How should we see what is wrong with your code, if we cannot see your code? You know that you can download source code for these obj-loaders, various places right? If you download a few and find one that works then all you have to do, is to compare the code that works with your code that doesn't work. Shouldn't be too difficult.
    Sorry for bringing this up again. I solved the above problem (it was due to a major misunderstanding of one of the opengl functions).

    But do you / does anyone know a good loader for .obj/.mtl files or other files in general? I did some research in the internet but found no loader with a good documentation.

  4. #4
    Newbie Newbie
    Join Date
    Apr 2013
    Posts
    1

    Having the same problem but no solution

    Quote Originally Posted by fp13__ View Post
    Sorry for bringing this up again. I solved the above problem (it was due to a major misunderstanding of one of the opengl functions).

    But do you / does anyone know a good loader for .obj/.mtl files or other files in general? I did some research in the internet but found no loader with a good documentation.
    I'm having the same problem. Could you elaborate what the problem was you had?

    Sincerely,
    H.P.

Posting Permissions

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