Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Using 3d models (.obj) AND materials (.mtl) in an opengl application
QtWS25 Last Chance

Using 3d models (.obj) AND materials (.mtl) in an opengl application

Scheduled Pinned Locked Moved General and Desktop
15 Posts 4 Posters 29.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    karthiksrini
    wrote on last edited by
    #1

    Hi,

    I have been trying to figure out how to use .obj format 3d models and the associated material files (.mtl) using opengl in a Qt app.
    I have had enough examples on loading the obj model into the application which I am able to do. But I can't figure out how to use the mtl files.

    Any suggestions or pointers on this would be really useful.

    Thanks,
    Karthik

    1 Reply Last reply
    0
    • Z Offline
      Z Offline
      ZapB
      wrote on last edited by
      #2

      I think that you will have to parse the MTL files yourself and translate them into suitable calls to glLightfv. I do not know of anything with Qt that will do this for you.

      Have you checked out the "Qt3d":http://qt.gitorious.org/qt-labs/qt3d stuff in gitorious? This may have some classes that can help you. I certainly think that it provides helpers fo rthe .obj format.

      Nokia Certified Qt Specialist
      Interested in hearing about Qt related work

      1 Reply Last reply
      0
      • K Offline
        K Offline
        karthiksrini
        wrote on last edited by
        #3

        [quote author="ZapB" date="1300188083"]I think that you will have to parse the MTL files yourself and translate them into suitable calls to glLightfv. I do not know of anything with Qt that will do this for you.

        Have you checked out the "Qt3d":http://qt.gitorious.org/qt-labs/qt3d stuff in gitorious? This may have some classes that can help you. I certainly think that it provides helpers fo rthe .obj format.[/quote]

        Thanks. I was just hoping that someone would've already done something like parsing the mtl files and could possibly help me with that. I will checkout Qt3d though and see what's in it.

        1 Reply Last reply
        0
        • L Offline
          L Offline
          laumaya
          wrote on last edited by
          #4

          Hi,
          Two others possibilities :

          • you can use "GLC_lib":http://www.glc-lib.net to load and view your model
          • you review code of the class : "GLC_ObjMtlLoader":http://www.glc-lib.net/doc/class_g_l_c___obj_mtl_loader.html

          @+

          1 Reply Last reply
          0
          • K Offline
            K Offline
            karthiksrini
            wrote on last edited by
            #5

            [quote author="laumaya" date="1300301897"]Hi,
            Two others possibilities :

            • you can use "GLC_lib":http://www.glc-lib.net to load and view your model
            • you review code of the class : "GLC_ObjMtlLoader":http://www.glc-lib.net/doc/class_g_l_c___obj_mtl_loader.html

            @+[/quote]

            Thanks. That sounds interesting. Let me dig my teeth into that see how it tastes... :D
            laumaya, is that project something you run all by yourself?

            1 Reply Last reply
            0
            • L Offline
              L Offline
              laumaya
              wrote on last edited by
              #6

              [quote author="karthiksrini" date="1300353964"]
              laumaya, is that project something you run all by yourself?[/quote]

              Yes.

              1 Reply Last reply
              0
              • K Offline
                K Offline
                karthiksrini
                wrote on last edited by
                #7

                Laumaya, I am trying to build glc_lib and the examples. The main glc library builds fine. But when I tried to build example09, I get a linker error. Any idea? I have the .pro file configured to find the include files and libs.

                @release/glwidget.o:glwidget.cpp:(.text+0x18c): undefined reference to _imp___ZN20GLC_3DViewCollection11boundingBoxEv' release/glwidget.o:glwidget.cpp:(.text+0x600): undefined reference to _imp___ZN20GLC_3DViewCollection11boundingBoxEv'
                release/glwidget.o:glwidget.cpp:(.text+0x7d4): undefined reference to _imp___ZN9GLC_3DRepaSERKS_' release/glwidget.o:glwidget.cpp:(.text+0x11fb): undefined reference to _imp___ZN20GLC_3DViewCollection11boundingBoxEv'@

                1 Reply Last reply
                0
                • L Offline
                  L Offline
                  laumaya
                  wrote on last edited by
                  #8

                  It seems that you have not installed GLC_lib correctly.
                  Please, check the help page of GLC_lib : "http://www.glc-lib.net/help.php":http://www.glc-lib.net/help.php

                  1 Reply Last reply
                  0
                  • K Offline
                    K Offline
                    karthiksrini
                    wrote on last edited by
                    #9

                    ZapB, I tried Qt3d and the model viewer example directly loaded the obj file along with mtl files! Thanks!
                    I however had some difficulty loading the 3ds format of the same model though.

                    1 Reply Last reply
                    0
                    • K Offline
                      K Offline
                      karthiksrini
                      wrote on last edited by
                      #10

                      [quote author="laumaya" date="1300786694"]It seems that you have not installed GLC_lib correctly.
                      Please, check the help page of GLC_lib : "http://www.glc-lib.net/help.php":http://www.glc-lib.net/help.php
                      [/quote]

                      Thanks! I was using qt creator and I didn't realize that I had forgotten the make install.
                      Another quick question. Can I load animated models too using GLC_lib?

                      1 Reply Last reply
                      0
                      • L Offline
                        L Offline
                        laumaya
                        wrote on last edited by
                        #11

                        No, GLC_lib doesn't support animated model.

                        1 Reply Last reply
                        0
                        • H Offline
                          H Offline
                          hurricane
                          wrote on last edited by
                          #12

                          hi karthik,

                          i have just started learning Qt.I m getting problems in loading 3D textures from obj files.Can u please send me some examples showing how to load 3d textures from obj files...

                          Regards
                          hurr[i]cane

                          1 Reply Last reply
                          0
                          • K Offline
                            K Offline
                            karthiksrini
                            wrote on last edited by
                            #13

                            [quote author="hurricane" date="1313478252"]hi karthik,

                            i have just started learning Qt.I m getting problems in loading 3D textures from obj files.Can u please send me some examples showing how to load 3d textures from obj files...

                            Regards
                            hurr[i]cane [/quote]

                            You can use both Qt 3D and GLC_Lib as mentioned. Both these have examples. I was able to directly load them using the examples.

                            1 Reply Last reply
                            0
                            • H Offline
                              H Offline
                              hurricane
                              wrote on last edited by
                              #14

                              I want to load 3D models and textures for symbian 3 devices using Qt with openGL ES 1.1 . Can u provide some example for that...

                              Regards
                              hurr[i]cane

                              1 Reply Last reply
                              0
                              • K Offline
                                K Offline
                                karthiksrini
                                wrote on last edited by
                                #15

                                [quote author="hurricane" date="1313562019"]I want to load 3D models and textures for symbian 3 devices using Qt with openGL ES 1.1 . Can u provide some example for that...

                                Regards
                                hurr[i]cane[/quote]

                                Ah, for symbian... Then I guess you can't use GLC Lib. (laumaya?)
                                However I think you should be able to use Qt 3d. I haven't tried it on symbian. So I don't have exact pointers for you there.

                                1 Reply Last reply
                                0

                                • Login

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • Users
                                • Groups
                                • Search
                                • Get Qt Extensions
                                • Unsolved