How to show an object from maya in opengl?

Started by
1 comment, last by CrimsonSun 16 years, 10 months ago
hi there! I just wondered if I could ask you a question which is haunting me: I have made an object in Maya and converted it to .cpp-format, and have included this converted file in my project like this: #included "catWalk.cpp". my problem is how to show this object in my own 3d world. How can "put" it into my scene? is this very complicated to do, or is it possible you can show me approximately how I can do this?(I am relatively new to C++) what am going to use it for? I and a group of friend are planning to make our own 3d-scene, and therefore we needed a way to include maya-objects in our scene. note: I used Deep Exloration for the exportation process. thanks so very much! ;)
Advertisement
0) Do not #include .cpp files. You will generate linker errors because most development environments will automatically attempt to compile all files ending with .cpp.

1) There's no "standard" format for models "exported" to C++ code; in order to render that model, you'll have to make the appropriate OpenGL calls that the generated C++ code was designed to use. You'd probably have to read the exporter's documentation, but it might have comments. I suspect the C++ file contains mostly a large buffer of vertices you could render with glVertex3f, to get started (although that will get prohibitively slow eventually).

Overall "exporting" a model to C++ code is not really the best way to go about loading models.
A common way of doing this is to create a maya file class. This class loads a maya file and extracts all the necessary information needed to display it such as vertex coordinates, keyframe data, texture coordinates, etc, and stores it in a format that can be used by other class methods to display an object. This requires you to know something of the maya file format. I'm sure you can find some documentation on it somewhere.

This topic is closed to new replies.

Advertisement