Export OpenGL models to .OBJ

I know there is a lib called glm.c to read in .obj file to display as models in OpenGL. Is it possible to export .obj file from OpenGL models?

There’s no such thing as OpenGL models. If you have an OpenGL program that displays a model then it is probably read from disk by the application in some format (obj,3ds,collada,etc…) unless it was hardcoded in the application which is very unlikely.

hm…sorry that i’m a beginner in OpenGL.
For my case I just try out some functions like glutSolidCube…etc to create a 3D model using OpenGL.

After I created the model, I want to export to it to .obj file. That’s it. Is it possible?

No need to be sorry :wink:

But unfortunately what you’re trying to do is not possible. Calls to glutSolidCube are basically a set of glVertex and glTexCoord calls that are hardcoded within the glut library. You can check out the glut source code to find out which calls it makes but that won’t help you to export a model.

OpenGL is used ot visualize the data and does not provide means to import or export models. You should be able to find some libraries by which you can import models to be visualized but if you only have sets of vertices,texcoords,colors,faces,etc. you have to write your own exporting routine. The Obj wavefront format is very easy to understand.

Thanks a lot. :slight_smile:

Well you could use this:

But it might be a bit complicated for you to use. (also could only do one-off exports and not have it as part of an application)

Sorry, I’m a newbie of openGL and my boss gave me a mission to capture the 3D model from an openGL scene. We want to display and assemble the model in our software. But i have no idea how to do this and find nowhere to get OGLE :frowning: Could you give me some clue on how to do this by using GLIntercept? Be grateful!