A newbie with a displaylist problem.
Hi everyone, I have a problem with the displaylists. What I''m trying to do is make an array of displaylists, one list for each model. I don''t even know if it''s the right thing to do.
If I just draw the models everything works fine but when I try to do it with displaylists only the first and last model in the sector array shows up.
I would like some feedback on this, if it''s the right thing to do, and somebody has done it, I would like links to code examples.
Ok m8, first of all we could use some code as reference here otherwise we''re just guessing what the problem is. We can''t be specific unless you post the code.
About whether using a display list is appropriate in your project, that is up to you. In OpenGL 2 things are primarily used to optimise rendering by cutting down on function call overhead, display lists and vertex arrays (Often abbreviated to VA). It is up to you as a programmer to decide which is best suited to your project. I recommend reading more information on these things. Display lists are static because you have to compile them before you can use them. VA''s are more dynamic in the way that you dont have to compile them because all the vertex/colour/texture/normal info is stored in a bunch of arrays.
Hope this helps! Please post more information though, maybe then we can help you further.
-------- E y e .Scream Software --------
----------------------------------------
/-\
http://www.eyescream.cjb.net | * |
\-/
----------------------------------------
About whether using a display list is appropriate in your project, that is up to you. In OpenGL 2 things are primarily used to optimise rendering by cutting down on function call overhead, display lists and vertex arrays (Often abbreviated to VA). It is up to you as a programmer to decide which is best suited to your project. I recommend reading more information on these things. Display lists are static because you have to compile them before you can use them. VA''s are more dynamic in the way that you dont have to compile them because all the vertex/colour/texture/normal info is stored in a bunch of arrays.
Hope this helps! Please post more information though, maybe then we can help you further.
-------- E y e .Scream Software --------
----------------------------------------
/-\
http://www.eyescream.cjb.net | * |
\-/
----------------------------------------
Ok, would really love if you could direct me to a web resource or a book or something about display lists, but the basic question really is if they use display lists in the really big game projects, if not, why?
Anyways here is the code that doesnt work:
http://hem.passagen.se/sarvell/display.txt
The complete code is here:
http://hem.passagen.se/sarvell/mesh_reading.zip
Anyways here is the code that doesnt work:
http://hem.passagen.se/sarvell/display.txt
The complete code is here:
http://hem.passagen.se/sarvell/mesh_reading.zip
Thanks for the links.
The line :
model[0]=glGenLists(nrmodels);
does store the first index of the display list in the ONLY THE FIRST INTEGER OF THE ARRAY ''model'' !
In fact, you don''t have to allocate a dynamic array of integers to store the display list indices.
When you ask OpenGL to create display lists, OpenGL finds (at least, try to) a CONTIGUOUS set of lists.
You just need the first reference of the list, and the number of the lists.
You should do something like that instead :
Import :
Import import;
int nrmodels = import.numModels;
GLuint model; /* Not a pointer anymore */
Call the display lists :
for (int i = 0; i < nrmodels; i++)
{
glCallList(model+i);
}
Build the lists :
model=glGenLists(nrmodels);
for (int mainloop = 0; mainloop < nrmodels; mainloop++)
{
numfaces = import.sector[mainloop].numfaces;
glNewList(model+mainloop,GL_COMPILE);
glBindTexture(GL_TEXTURE_2D, texture[2]); // Select A Texture Based On filter
...
The line :
model[0]=glGenLists(nrmodels);
does store the first index of the display list in the ONLY THE FIRST INTEGER OF THE ARRAY ''model'' !
In fact, you don''t have to allocate a dynamic array of integers to store the display list indices.
When you ask OpenGL to create display lists, OpenGL finds (at least, try to) a CONTIGUOUS set of lists.
You just need the first reference of the list, and the number of the lists.
You should do something like that instead :
Import :
Import import;
int nrmodels = import.numModels;
GLuint model; /* Not a pointer anymore */
Call the display lists :
for (int i = 0; i < nrmodels; i++)
{
glCallList(model+i);
}
Build the lists :
model=glGenLists(nrmodels);
for (int mainloop = 0; mainloop < nrmodels; mainloop++)
{
numfaces = import.sector[mainloop].numfaces;
glNewList(model+mainloop,GL_COMPILE);
glBindTexture(GL_TEXTURE_2D, texture[2]); // Select A Texture Based On filter
...
I believe that the really big commercial game engines out there do not use display lists because they are static. IE you can''t animate them! All game players these days expect fluid 30+ fps animation interpolated to synch with the refresh rate! You simply can''t do that with display lists.
Well, to be honest maybe they do use display lists, but I have no doubt in my mind that they also use VA''s and any models which are animated are displayed using VA''s!
-------- E y e .Scream Software --------
----------------------------------------
/-\
http://www.eyescream.cjb.net | * |
\-/
----------------------------------------
Well, to be honest maybe they do use display lists, but I have no doubt in my mind that they also use VA''s and any models which are animated are displayed using VA''s!
-------- E y e .Scream Software --------
----------------------------------------
/-\
http://www.eyescream.cjb.net | * |
\-/
----------------------------------------
Well, I won''t say they''re using displaying lists because I don''t really know (eg I''m not working in the gaming industry) but they should use display lists.
First of all, there are several static models in every scene : I''ve never seen any game where everything is animated (read as : complex animation, because translation/rotation/scale can be done with display lists).
And secondly, it is possible to use vertex arrays in display lists, even though it has some limitations of course.
First of all, there are several static models in every scene : I''ve never seen any game where everything is animated (read as : complex animation, because translation/rotation/scale can be done with display lists).
And secondly, it is possible to use vertex arrays in display lists, even though it has some limitations of course.
Thanks for the help guys I really appreciate it. I got an answer from another guy too and he mentioned "Compiled Vertex Arrays" I assume this is what you mean when you say Vertex Arrays?
If this is something more than just an array with the vertex coordinates in it I would like directions to web resources and even books if there are any.
If this is something more than just an array with the vertex coordinates in it I would like directions to web resources and even books if there are any.
Btw vincoof I did just like you said and now only one of the four models is displayed, the second one in the sector array.
vincoof disregard the above post please, it works now, it didn''t work before because of a typo. Thanks man/m8.
Compiled Vertex Arrays (aka CVA) is an extension of Vertex Arrays (aka VA).
CVA is a bit faster than VA, but :
1- it is an extension, so you probably have to write some extra code to make it working,
2- it is an extension, thus not all graphics cards/drivers support it
3- it is compiled, so you won''t be able to modify the vertex data
I recommend not using CVA at the beginning, since it is easier to use VA, and CVA are just a bit faster.
But if you really need for critical performance, then you may take a look at CVA and optimize your code later.
CVA is a bit faster than VA, but :
1- it is an extension, so you probably have to write some extra code to make it working,
2- it is an extension, thus not all graphics cards/drivers support it
3- it is compiled, so you won''t be able to modify the vertex data
I recommend not using CVA at the beginning, since it is easier to use VA, and CVA are just a bit faster.
But if you really need for critical performance, then you may take a look at CVA and optimize your code later.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement