How to make glCallList() have ID??

Started by
3 comments, last by ma_hty 14 years, 10 months ago
Read many books.But did not explain how to do this. example: //....... glColor3f(1.0f,1.0f,1.0f); glTranslatef(0.0f,0.0f,-5.0f); glCallList(1);//←−−−−−−−−−−−−−−−−−−How to do it? //....... glColor3f(1.0f,1.0f,1.0f); glTranslatef(0.0f,4.0f,-5.0f); glCallList(1); //....... Above, the establishment of two model. In the following code , I once again how to operate model. I would like to create glCallList() should be marked with the only. //int *myrun[3]; //myrun[0]=&glCallList(1); //....... //glTranslatef(0.0f,0.0f,-5.0f); //myrun[0]; //....... //glTranslatef(2.0f,3.0f,-5.0f); //myrun[0]; //....... How do I?
Advertisement
You should try to make the question a tad more clear but as I gather your attempting to create a call list.

Suggest declaring a GLuint with an appropriately associated variable name.

If my var name was mesh_list here is the following code

mesh_list = glGenLists ( 1 ); // int 1 is the ID i've given it
glNewList ( mesh_list, GL_COMPILE );

... gl Calls ..

glEndList ( );

Now in your main loop when going to render this model based on your call
simply use

glCallList(mesh_list);

Hope this helps you!
Quote:Original post by lacabos
mesh_list = glGenLists ( 1 ); // int 1 is the ID i've given it


No it isn't, it means that you want to allocate one list.
My iOS 3D action/hacking game: http://itunes.apple....73873?ls=1&mt=8
Blog
I would like to express my meaning wrong.
This is the google translated Chinese to English.

glCallList(1);//Part,ID=A
//......
glCallList(1);//Part,ID=B
//......
glCallList(1);//Part,ID=C
//......
glTranslatef(0.0f,3.0f,-5.0f);
//I would like to change the "ID = A" location

Code in the future, I may need to continue to change.
I do not know how to do.
Oh, "google translated". Please STOP doing that. It made you sounds like an idiot. If you have problem to make some fluent sentences, you can use simple sentences instead. Although using simple sentences only is not efficient for communication, at least they can be human readable.

Be frank, I have no idea what you are asking about at all. However, there is no obvious way to assign a specific value as the ID of a display list (you shouldn't do it anyway).

//myrun[0]=&glCallList(1);

Also, glCallList() doesn't return any value. So, the command above doesn't make sense. Even if it does return a value, this command almost certainly will cause a problem. Look, you should not keep the address of the local variables of another scope.

If you can make a mistake like this, you must be a beginner. In this case, please play by the rule first.

[Edited by - ma_hty on June 9, 2009 12:42:07 AM]

This topic is closed to new replies.

Advertisement