i'm quite a new programmer in opengl. i want to model a liver and other irregular shape objects using primitive opengl commands, without relying on available higher API and software such as Maya, 3DMax, etc.
i would like to see some sample in C/C++ implementation. any one can please help ? thanks a lot !
what do you mean by sample code ? code that shows you how to render primitives using opengl ? i could provide you with that. i could mail it to you... let me know...
yup, i would like some sample code on rendering irregular shape 3D object, eg. liver, phone, animal, etc. which is modeled using OpenGL basic command only, not relying on the available 3D modeler such as Maya/3DMax.
would it be feasible ? afterwards, i need to animate the objects modeled.
thx for the help !
I have three points:
- It is possible to model anything, and to animate anything, simply using OpenGL commands because even if you do use Maya, 3DSMax etc, you still need to feed the data into OpenGL commands
- It isn't practical to draw more than a VERY simple object manually. You need to figure out all the co-ordinates and type them in. It's hard to do and harder to maintain. Like writing your whole app in ASM.
- Why a liver? why not a heart, spleen, stomach, small intestine...
that's about it
i don't suggest it as well (read it over on nutty.org, too:D)
use a modeler..
The reason you dont want to handcode the object is because anything larger than a cube requires a great number of lines of code. And they all look like this:
glVertex3f(1.0f, 1.0f, 1.0f);
glVertex3f(3.0f, 246.0f, 234.0f);
glVertex3f(246.0f, 234.0f, 2465.0f);
glVertex3f(45.0f, 543.0f, 65.0f);
glVertex3f(1.0f, 54.0f, 634.0f);
glVertex3f(234.0f, 524.0f, 1.0f);
glVertex3f(2654.0f, 234.0f, 1.0f);
glVertex3f(1.0f, 352.0f, 1.0f);
Or something to that degree, but with less spastic numbers. Now imagine trying to come up with the verticies for a 1000 poly model. (thats 1000 triangles, so if you were to do it with GL_TRIANGLES, 3000 glVertex3f() calls) What a nightmare, huh? So you need to let the artist make the object, and instead write a class that will load in that object and draw it efficiently. This is much easier to do.
I dont know why you dont want to use models made by professional modeling programs, but perhaps its because you want to make them yourself and you dont have the money for 3DS Max? First of all, there are many models people have made which they have given for free use on the Internet. Apart from that, there are also openSource modelers that you can use for free.
Hope this helps.
thanks a lot for the reply. in the end, i decided to use 3dmax to model the objects i want, then use a opengl loader for 3dmax format file. (give up... nobody recommend me to use opengl itself =p )
initially, i thought that by using opengl itself to model the object, i don't have to convert the 3dmax / maya codes into opengl to be manipulated. the project i want to do is to make real time user interaction on the model.
so by using opengl to model the object itself, it enables me to store the object data in my data structure, and render it faster in C++/C# implementation.
right now, i'm still not clear about the project design and feasibility by converting 3dmax model into opengl. anyone would like to comment or suggest something ?
There is no way to draw anything in OpenGL, without OpenGL commands. The easy way is to use the data from the model file, and pass it to OpenGL via appropriate commands. The hard way, and never used way, is to manually do it.
Here's a .3ds loading openGL dooda:
http://www.home.no/apron/english/apron.htm?tut\_gl (scroll down)
Need to sleep,
Here's a really good tutorial on loading .3ds files in C (I plan to use it too)
Sorry, look below (delete this post please)
thx for the link, i'll certainly read through it