Modeling

If i have a good model , how can i create it with
opengl ?
I practiced some simple model with
glBegin(GL_TRIANGLES)

glEnd()
but it is too difficult for complicated model ,
any good idea?

For complex models you use a 3D modeler/editor program(CAD), then load in the file created by the program into openGL.

You could use a 3D modelers that edits Quake models and worlds, and then load that data into your program.

Lots of example on how to load quake models into a openGL program.

Originally posted by <Turn right>:
[b]If i have a good model , how can i create it with
opengl ?
I practiced some simple model with
glBegin(GL_TRIANGLES)

glEnd()
but it is too difficult for complicated model ,
any good idea?[/b]

Maybe i didnt tell what i want to say

What i dont know is how to load a complex model
in a simple way instead of vertex by vertex.

Loading it vertex by vertex is the most simple way, another would be to use someone elses model loading routine.

Originally posted by <Turn right>:
[b]Maybe i didnt tell what i want to say

What i dont know is how to load a complex model
in a simple way instead of vertex by vertex.[/b]

Originally posted by <Turn right>:
What i dont know is how to load a complex model
in a simple way instead of vertex by vertex.

By ‘load’ you mean send it to the card maybe ? So try to search about vertex arrays or VBO (the extension name is GL_ARB_vertex_buffer_object). I am not too experienced with that.

But using immediate mode (vertex by vertex) is not so bad to start with. You can do that with display lists, and data will stay on the card.

attempting to create a complex 3D model in OpenGL by plotting vertex after vertex is masochistic.

as nex suggested before, the easiest way is to create your model in a 3D modeling studio (3D SMax, etc…) and then parse the file and load the data into structures in your program.

you could create arrays for your vertices and read the vertex data from the file into your arrays. After that you could pass these vertex arrays to OpenGL and batch render them.

this is the simplest and fastest way to render complex 3d geometry in OpenGL (as far as I’m aware anyway).

Thanks , your help is appreciated!

Hey!

There is a plugin for 3DS Max that can export a
*.cpp file containing functions like
void DrawShape01()
{
glBegin(…);
glVertex(…);
glVertex(…);
.
.
.
glEnd();
}

it is called glexport.dle and you can find it on the net (it’s free)
just copy it into the <stdplugs> folder

If it’s calling glVertex* the implementation is a crude one. While this makes your life easier, expect your rendering times to suffer in the presence of high polygon count models.

For complex geometry you really want to use Vertex Arrays or VBOs.