Displaying Texture OOP

Started by
15 comments, last by python_regious 19 years, 7 months ago
Heh, no problems [smile].
If at first you don't succeed, redefine success.
Advertisement
Yeah I've done that a time or two. Took me a bit to figure it out.

-=[ Megahertz ]=-
-=[Megahertz]=-
Hello, I have a new question - it is a theoretical one.

I know it is possible to, say, load a .3ds file into OpenGL using a custom load function or the like. I decided that I didn't want to have a .3ds file sitting around, so instead of loading from a file, my .3ds model is a part of the code (I initialize an array with these vertices, etc).

Now I am working with texture maps and want to do the same thing. I know how to load a texmap from a file, but now I want to just include it as part of my code - you know, initialize it as a variable without having that extra .raw in with my executable.

So I would end up with a bigger executable, basically.

Now, the 3ds model I am using as well as the texture map both appear throughout the entire run of the program, so I figure I don't care about the overhead, but... I also haven't seen this approach taken very much and I wanted to know: is it a good idea? Or is it better to load from files?

Opinions and ideas? I would like to develop an educated opinion before I get too far in.
No! Bad idea to do that. You'd have to recompile your code, everytime you want to load a different model, change it, or anything. Just... No.
If at first you don't succeed, redefine success.
Well, I think you could include your textures as resources (if you're doing windows programming). I've done this for screensavers, since I don't like to include extra files for that.

Maybe you could include your mesh files as resources too, but I don't know.

Hope this helps.
-=[ J ]=-I always forget to change the tagline.
Thank you very much for your comments. The more I think about it, the more it seems that loading a model as a part of the code's compilation (or loading a .raw bitmap as the case may be) is not very versatile or flexible. Also, I suppose that if you have a loader, you can reuse that as well instead of having to create a new array of verts. Also, if I assign an array as part of my code, even if I free that array when I am done, all that space must still be taken up in memory since it is literally a part of my program/executable (where I assign it).

Do you think there are any advantages to making a (ie) 3ds file a part of the code rather than loading it from a file? Or would it be totally useless?
Quote:Original post by solenoidt
Do you think there are any advantages to making a (ie) 3ds file a part of the code rather than loading it from a file? Or would it be totally useless?


As jjmontes said, unless you're writing a screensaver or something, and want it to be in one exe, then no. There is no reason to put the model in the exe. It would, pretty much, be totally pointless, and detremental to performance and would be really really inflexible.

Of course, I'm talking about PC development now. I know that with the GBA you have to do that... From what I read on GBA development a few months back anyway.
If at first you don't succeed, redefine success.

This topic is closed to new replies.

Advertisement