Modeling a liver with opengl primitive commands

3a28227e8f3c9837610adb0c0a76e654
0
like_gobeawan 101 Jun 30, 2003 at 09:16

Hi,
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 !

11 Replies

Please log in or register to post a reply.

F7a4a748ecf664f189bb704a660b3573
0
anubis 101 Jun 30, 2003 at 14:21

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…

3a28227e8f3c9837610adb0c0a76e654
0
like_gobeawan 101 Jun 30, 2003 at 15:52

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 !

:) :D :)

0684f9d33f52fa189aad7ac9e8c87510
0
baldurk 101 Jun 30, 2003 at 17:20

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 :)

6ad5f8c742f1e8ec61000e2b0900fc76
0
davepermen 101 Jun 30, 2003 at 21:37

i don’t suggest it as well (read it over on nutty.org, too:D)

use a modeler..

C7787dfbc6b0c78ef4a2a8e7cfe1366c
0
keless 101 Jul 05, 2003 at 06:06

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:
glBegin(GL_TRIANGLE_STRIP);
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);
glEnd();

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.

3a28227e8f3c9837610adb0c0a76e654
0
like_gobeawan 101 Jul 05, 2003 at 06:34

hi all,

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 ?

:blink: :rolleyes: :)

0684f9d33f52fa189aad7ac9e8c87510
0
baldurk 101 Jul 05, 2003 at 07:37

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.

065f0635a4c94d685583c20132a4559d
0
Ed_Mack 101 Jul 12, 2003 at 03:17

Here’s a .3ds loading openGL dooda:

http://www.home.no/apron/english/apron.htm?tut_gl (scroll down)

Need to sleep,

Ed Mack

065f0635a4c94d685583c20132a4559d
0
Ed_Mack 101 Jul 13, 2003 at 05:19

Here’s a really good tutorial on loading .3ds files in C (I plan to use it too) :D

Sorry, look below (delete this post please)

Ed Mack

F7a4a748ecf664f189bb704a660b3573
0
anubis 101 Jul 13, 2003 at 06:02

thx for the link, i’ll certainly read through it

065f0635a4c94d685583c20132a4559d
0
Ed_Mack 101 Jul 13, 2003 at 22:26