3D modeling software, bitmaps and OpenGL

Started by
5 comments, last by NotAYakk 17 years, 6 months ago
Hi All, Since I have googled for a couple of hours on this and cannot find an answer, it is probably a stupid question that everyone knows. But here goes anyway. :) In Chapter 6 of Beginning OpenGL Game Programming, it talks about using bitmaps for 2D objects in a game. Well... if I want to use 3D modeling software like K3D or Wings3D to create a 3D game character, how do I go about using the character in the game. For example, in K3D you can export your 3D object as a tiff. But isn't that going to be a 2D image? If I load the image into an OpenGL program, will I be able to rotate the object around and see it's backside? I guess what I am asking here is this. I see how drawing objects with polygons in OpenGL works and how you can rotate them and such. But how does 3D modeling software fit into this picture? Obviously if someone wanted to create a game they would not try to do everything with OpenGL code or it would take forever. many many thanks for your help! -Barry
Advertisement
To display models, you'll have to write code to load in all the vertices, texture coordinates, and whatever information the model would contain. Once you've loaded it in, you'll need to create a method to draw each triangle in your model. You'll have to customize your loading method to be able to load a certain type of model. To find out how to load a certain file format like MD2, you can just google for MD2 file format for example, and you'll find details on how the model is stored in the file. If you convert a model into an image, you will not be able to rotate around it. The reason K3D probably has the ability to export your model as tiff is so you can create sprites out of your model. It'll probably output images of your model from many different directions.

You can see some example code for loading and rendering MD2 models here: http://tfc.duke.free.fr/coding/md2-specs-en.html
You don't write openGL code that creates a particular model (well, not by hand!).

Instead you write openGL code that loads a file format and creates the model you loaded.

That extra level of abstraction makes all the difference!
awesome! Thanks for the replies!
Quote:Original post by NotAYakk
You don't write openGL code that creates a particular model (well, not by hand!).


Actually you can write code that creates a model for you. Its called procedural content generation. In fact, one of the posts on the front page demonstrates it. http://www.gamedev.net/community/forums/topic.asp?topic_id=415096
In that image of the day, he is generating his tree geometry.
That is quite impressive!
Quote:Original post by ScottC
Quote:Original post by NotAYakk
You don't write openGL code that creates a particular model (well, not by hand!).


Actually you can write code that creates a model for you. Its called procedural content generation. In fact, one of the posts on the front page demonstrates it. http://www.gamedev.net/community/forums/topic.asp?topic_id=415096
In that image of the day, he is generating his tree geometry.


Sure, but he doesn't write the code that generates each tree seperately. :)

He writes a bunch of code that generates trees, then takes some input and uses that to generate each tree.

This topic is closed to new replies.

Advertisement