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

Thread: import .x file

  1. #1
    Intern Newbie
    Join Date
    Sep 2009
    Location
    Corroios, Portugal
    Posts
    48

    import .x file

    Is it possible to import a 3d studio max file, probably exported as .x (like in some game engines) to be rendered in OpenGL? How?

    My thanks in advanced

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Dec 2000
    Location
    Reutlingen, Germany
    Posts
    2,042

    Re: import .x file

    Of course!

    By writing an importer.
    GLIM - Immediate Mode Emulation for GL3

  3. #3
    Intern Newbie
    Join Date
    Sep 2009
    Location
    Corroios, Portugal
    Posts
    48

    Re: import .x file

    Can you give me any reference or link so that i can read as an example?

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Dec 2000
    Location
    Reutlingen, Germany
    Posts
    2,042

    Re: import .x file

    Sure.

    Having coded an x-importer, i found this page most informative:
    http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx

    First of all, google for the "x file format". There are several articles that explain how the file format works in general.

    When you then want to know the details, to implement it, that msdn-page will be very valuable.

    The format is actually quite straight-forward to understand, but implementing an importer is a bit of work.

    Jan.
    GLIM - Immediate Mode Emulation for GL3

  5. #5
    Junior Member Newbie
    Join Date
    Jan 2007
    Location
    Birmingham, UK
    Posts
    12

    Re: import .x file

    This article should help Loading and displaying .X files without DirectX .. Its a bit old, but it still renders X files in OpenGL. It basically goes into the file format in more detail, and example code to load a model.

  6. #6
    Intern Newbie
    Join Date
    Sep 2009
    Location
    Corroios, Portugal
    Posts
    48

    Re: import .x file

    Thanks for all your answers.
    I see this is not an easy task. Is there any other way, maybe a most common way to add 3d Studio Max or Maya objects, to OpenGL and control them?

  7. #7
    Senior Member OpenGL Guru
    Join Date
    Dec 2000
    Location
    Reutlingen, Germany
    Posts
    2,042

    Re: import .x file

    Nope. OpenGL does not provide any built-in mechanisms. It allows you to render stuff. Where you get the data from, and how that is stored etc. is not a concern of OpenGL. So no matter what format you are trying to use, be it for models, textures, animations, whatever, you always need to write your own importers (or use other peoples importers, if there are any).

    Part of the reason is, that there is no "standard" way to render your stuff. Someone might use VBOs, someone else uses display lists, the layout of the data can change, depending on your needs etc., so having ONE importer is usually not possible, because everyone has different needs how to render things.

    Jan.
    GLIM - Immediate Mode Emulation for GL3

  8. #8
    Junior Member Regular Contributor
    Join Date
    Aug 2009
    Posts
    126

    Re: import .x file

    You could also write your own exporter (3d modeller) and importer (openGL)...

    I've my own exporter for blender (with python), that exports ertices,UVs and animations...

    I think thats the "easiest" ^^


    ^^


  9. #9
    Senior Member OpenGL Lord
    Join Date
    May 2009
    Posts
    5,923

    Re: import .x file

    I think thats the "easiest"
    Technically, what would be "easiest" is if Blender had a decent exporter to Collada, which has a specific and well-documented format. Then you can write an offline tool to convert this into whatever format you want.

Posting Permissions

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