I am new to openGL C++ and what I wanted to know is if there was a pre-existing function in the OpenGL library that would allow me to import a 3d or 2d model?

For example, if I make a 3d image using photoshop, or a 3d model using 3ds max could I use a library in openGL example (not real function): glUse3dimage(3dmodel); ?

Or would importing images be more difficult and I would have to make my own function? I am not really a good programmer so I wanted to see how difficult this would be.

Another question I had was if this was difficult would this be easier using openGL with another language? For example openTK with C#?

closed as off topic by Oded, FrustratedWithFormsDesigner, Steven Evers, gnat, ChrisF Apr 24 '12 at 21:15

Questions on Software Engineering Stack Exchange are expected to relate to software engineering within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    This question is fine for us. It would get closed on Stack Overflow. – ChrisF Apr 24 '12 at 16:23
  • 1
    @ChrisF: Fine for us and closed on SO are not necessarily related. It'd probably get some good answers on gamedev.se. – Steven Evers Apr 24 '12 at 16:58
  • @SnOrfus - good point. Ecurbed - if you want the question migrated to Game Dev flag it and we'll sort something out. – ChrisF Apr 24 '12 at 19:37
  • Closing as off topic temporarily until get final destination sorted out. – ChrisF Apr 24 '12 at 21:15
  • you can use SOIL2 or STBI to import images from jpg png gif etc. – Nfagie Yansaneh Aug 13 '17 at 11:21

There are no specific file handling or file format APIs in openGL http://www.opengl.org/archives/resources/faq/technical/miscellaneous.htm

You could dump textures of vertex buffers direct to disc and reload them, but it's much better to use some common 3D model format, like .obj

I would also recommend you get MeshLab to allow you to view and test your models independantly


No, thats not within the scope of OpenGL itself.

To load 3d models, one good tool is the Open Asset Import library:


For 2d models (assuming you mean images here), use whatever library available in your language/framwork for loading images, and then draw the pixels using opengl's functions.


OpenGL does not specify a standard for model or image data. Which means you can import data in whatever format you want. Which also means you have to write/obtain code to load the data in whatever format you want. I once implemented a parser for the 3D Object format. It was pretty straightforward, and many modelling applications at the time could export basic geometry into this format. If you want to load more sophisticated models (maybe with procedural textures specified, or animation data) you might want to look for an existing library that can do that, though it would also be a good learning experience. ;) There are many libraries for loading image data, I think I just found some from BMP loader code and used that.

I can't speak to using OpenGL with other languages, as I ever only wrote C and C++ and a tiny bit of Objective-C code for OpenGL. I know of JOGL which would let you use Java to write OpenGL applications, but I have never used it myself.

Not the answer you're looking for? Browse other questions tagged or ask your own question.