Jump to content

  • Log In with Google      Sign In   
  • Create Account


models, textures loading


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 doubstract   Members   -  Reputation: 102

Like
0Likes
Like

Posted 15 April 2014 - 02:53 PM

Hello everyone. I just have started learning OpenGL, and i have a problem. I am reading OpenGL SuperBible, i have all sample code, models, textures and other stuff from that book. I just have reached topic about textures, models and everything is okay, but models in samples are in "SBM" format, and textures are in "KTX". All i want to load models in other format(obj,3ds), and load textures in png or other popular format. How i can do it? Please, give me some code or something. I have downloaded all samples from here: openglsuperbible.com and I am programming with C++. Thanks for help!



Sponsor:

#2 alek314??   Members   -  Reputation: 239

Like
0Likes
Like

Posted 15 April 2014 - 06:58 PM

if you want to load obj format, you can write your own parser. it's simple. Google obj specification.

You could try freeimage lib for texture loading.



#3 arka80   Members   -  Reputation: 715

Like
1Likes
Like

Posted 16 April 2014 - 01:24 AM

you can give a try at soil lib for image loading and assimp for models loading.

Unluckly, opengl is not a full framework like DX, it only cover the rendering side of the whole thing. You have to do yourself everything else.



#4 haegarr   Crossbones+   -  Reputation: 3759

Like
0Likes
Like

Posted 16 April 2014 - 03:12 AM


… and load textures in png or other popular format. ...

Don't confuse "popular for the web" with "popular for 3D". Notice that PNG and similar popular image formats are for other, typically general purposes. Not all of them support an alpha channel (PNG does, e.g. JPG does not), only a few allows to store HDR images, nearly none of them allows to store multi resolution images, nearly none of them allows to store MIP map levels, nearly none of them allows to store array layers, nearly none of them support storing of multiple faces natively, probably none of them allows to store image data pre-encoded with a GPU friendly compression, and none (to my knowledge) of them allows to do all at once. The reason to use especially KTX is that it is one of the very very few public formats that allows for all of that. For example, to represent a 1024^3 texel cube map with pre-computed MIP mapping, you would need to use 6 faces by ld(1024) = 60 (!) PNG files where a single KTX file would be sufficient (this is, of course, a strong example, but nevertheless not unrealistic).

 

A usual way of handling texture resources is to let the artist store the asset in an appropriate format. This may be PNG or the like as long as the format would preserve all necessary features. Professionally formats like OpenEXR are more likely to be used when the demands grow. The resource processing then will read in images in the chosen format and convert / integrate them internally to a texture. Insofar your request for loading other formats is not untypical. However, don't be trapped in thinking that textures are like "ordinary" images; they are not! They are special!


Edited by haegarr, 16 April 2014 - 03:13 AM.


#5 Irlan R.   Members   -  Reputation: 1275

Like
0Likes
Like

Posted 23 April 2014 - 06:46 AM

Or if you have time, start parsing a .FBX or .DAE file format. It will be a good learning exercise.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS