When to use display lists
OK, I thought display lists speed up things, but I''m drawing a series of boxes(a window border for fullscreen) and decided to put it in a display list. I know the speed difference isn''t really anything, it takes 16 ticks in a display list compared to 12 when simply drawn each time, but I was wondering when would i use a display list?
btw, the ticks are from using the performance timer so i guess they''re accurate.
I''ve had this problem too; as it stands part of my code constructs a spinning wireframe sphere, drawing anywhere from 400 to 3200 polygons depending on the complexity setting selected. When the sphere is drawn directly, the motion is smooth and clear. However, when I put it into a display list, the motion is very jerky and the lines are also themselves less clear and kind of "fuzzy". So same question?
--
Mercy
--
Mercy
-- Mercy
quote:
Original post by Aeotaph
I''ve had this problem too; as it stands part of my code constructs a spinning wireframe sphere, drawing anywhere from 400 to 3200 polygons depending on the complexity setting selected. When the sphere is drawn directly, the motion is smooth and clear. However, when I put it into a display list, the motion is very jerky and the lines are also themselves less clear and kind of "fuzzy". So same question?
--
Mercy
You have line antialiasing enabled in your display list, but not your other code?
Death of one is a tragedy, death of a million is just a statistic.

If at first you don't succeed, redefine success.
As far as i know there are two advantages (my only source being the red book).
The first is that you dont have to resend all the drawing function calls that you would normally use to redraw an object. Its just one function and the thing is done.
The second, athough im not completely sure of this one but, when you generate a display list, OGL takes the time to select device compatible or accelerated parameters so that what your drawing runs as fast as it possibly can on hardware.
The first is that you dont have to resend all the drawing function calls that you would normally use to redraw an object. Its just one function and the thing is done.
The second, athough im not completely sure of this one but, when you generate a display list, OGL takes the time to select device compatible or accelerated parameters so that what your drawing runs as fast as it possibly can on hardware.
Obviously u are doing something wrong.
Some possible errors
1)You should only Compile the display list at load time or once in ur application using GL_COMPILE
WHen u need to use it, you should use glCallList.
2)It would help if you showed some code.
3)For objects with very low poly counts like 12 polygon cubes, you should render directly as there is some overhead in calling display lists.
Some possible errors
1)You should only Compile the display list at load time or once in ur application using GL_COMPILE
WHen u need to use it, you should use glCallList.
2)It would help if you showed some code.
3)For objects with very low poly counts like 12 polygon cubes, you should render directly as there is some overhead in calling display lists.
I am sure i'm doing it right, but am useing less then 12 quads, only creating 4 but i'm changing the color a lot, here's the part where i draw:
thanks for the reply
btw, the screens set up in ortho mode
[edited by - desertcube on August 10, 2003 6:07:07 AM]
#define FIRST_COLOR glColor3d(0.8, 0.8, 0.96)#define SECOND_COLOR glColor3d(0.4, 0.4, 0.5)void DrawWindow(){ int borderWidth = 5; int titleHeight = 25; int screenHeight = 600; int screenWidth = 800; glBegin(GL_QUADS); FIRST_COLOR; //Title bar glVertex2i(0, titleHeight); glVertex2i(screenWidth, titleHeight); SECOND_COLOR; glVertex2i(screenWidth, 0); glVertex2i(0, 0); glColor3f(1, 1, 1); //Show place of the icon glVertex2i(720, 2); glVertex2i(720, 22); glVertex2i(740, 22); glVertex2i(740, 2); FIRST_COLOR; //Left border glVertex2i(0, titleHeight); glVertex2i(0, screenHeight); SECOND_COLOR; glVertex2i(borderWidth, screenHeight - borderWidth); glVertex2i(borderWidth, titleHeight); FIRST_COLOR; //Bottom border glVertex2i(0, screenHeight); glVertex2i(screenWidth, screenHeight); SECOND_COLOR; glVertex2i(screenWidth - borderWidth, screenHeight - borderWidth); glVertex2i(borderWidth, screenHeight - borderWidth); FIRST_COLOR; //Right border glVertex2i(screenWidth, screenHeight); glVertex2i(screenWidth, titleHeight); SECOND_COLOR; glVertex2i(screenWidth - borderWidth, titleHeight); glVertex2i(screenWidth - borderWidth, screenHeight - borderWidth); glEnd();}
thanks for the reply
btw, the screens set up in ortho mode
[edited by - desertcube on August 10, 2003 6:07:07 AM]
There is nothing wrong with your code, as the guy said above, calling a display list for really simple geometry brings with it extra overheads. for example if i wanted to draw a STATIC stack of 100 cubes, instead of making a display list for a single cube and rendering loads, i would make a display list containing all 100 cubes.
as for your sphere, make sure you are only compiling the list once, not every frame, ive seen a number of people do that.
show yor code, we might see problems you dont.
"Very funny, Scotty. Now beam down my clothes."
as for your sphere, make sure you are only compiling the list once, not every frame, ive seen a number of people do that.
show yor code, we might see problems you dont.
"Very funny, Scotty. Now beam down my clothes."
Twitter: [twitter]CaffinePwrdAl[/twitter]
Website: (Closed for maintainance and god knows what else)
no, i think you mis-understood me. I''m not having problems with my code, i just thought it was odd that it was slower.
I have no problem with showing you the code, but I''ll warn you, it''s in Delphi, and not very neat Delphi ^_^;
(Sorry about the slow reply, I didn''t realise I had to enable watching specifically once I''d posted to a thread...)
As far as the comment about line anti-aliasing goes, that would make a lot of sense actually, but I have no idea how to enable or disable anti-aliasing? Still a n00b I fear...
This first bit is done as part of program initialisation, in the background while displaying the splash screen. I''ve omitted the math that actually fills st and sq with the vertices of the sphere''s constituent triangles and quads.
sphere := glGenLists(1);
glNewList(sphere,GL_COMPILE);
glPolygonMode( GL_BACK, GL_line ); // Make the sphere a wireframe
glPolygonMode( GL_FRONT, GL_line );
glColor3f(0.0,1.0,0.0); // All lime green
glBegin(GL_TRIANGLES);
for I := 1 to (2*b) do
begin
glVertex3f(st[I,1,1] , st[I,1,2] , st[I,1,3]);
glVertex3f(st[I,2,1] , st[I,2,2] , st[I,2,3]);
glVertex3f(st[I,3,1] , st[I,3,2] , st[I,3,3]);
end;
glEnd();
glBegin(GL_QUADS);
for I := 1 to (ni-1) do
begin
for J := 1 to b do
begin
glVertex3f(sq[I,J,1,1] , sq[I,J,1,2] , sq[I,J,1,3]);
glVertex3f(sq[I,J,2,1] , sq[I,J,2,2] , sq[I,J,2,3]);
glVertex3f(sq[I,J,3,1] , sq[I,J,3,2] , sq[I,J,3,3]);
glVertex3f(sq[I,J,4,1] , sq[I,J,4,2] , sq[I,J,4,3]);
end;
end;
glEnd;
glEndList;
[Subsequently during DrawGLScene:]
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslatef(0.0,0.0,-37.5);
glCallList(sphere);
Thanks for the help...
--
Mercy
(Sorry about the slow reply, I didn''t realise I had to enable watching specifically once I''d posted to a thread...)
As far as the comment about line anti-aliasing goes, that would make a lot of sense actually, but I have no idea how to enable or disable anti-aliasing? Still a n00b I fear...
This first bit is done as part of program initialisation, in the background while displaying the splash screen. I''ve omitted the math that actually fills st and sq with the vertices of the sphere''s constituent triangles and quads.
sphere := glGenLists(1);
glNewList(sphere,GL_COMPILE);
glPolygonMode( GL_BACK, GL_line ); // Make the sphere a wireframe
glPolygonMode( GL_FRONT, GL_line );
glColor3f(0.0,1.0,0.0); // All lime green
glBegin(GL_TRIANGLES);
for I := 1 to (2*b) do
begin
glVertex3f(st[I,1,1] , st[I,1,2] , st[I,1,3]);
glVertex3f(st[I,2,1] , st[I,2,2] , st[I,2,3]);
glVertex3f(st[I,3,1] , st[I,3,2] , st[I,3,3]);
end;
glEnd();
glBegin(GL_QUADS);
for I := 1 to (ni-1) do
begin
for J := 1 to b do
begin
glVertex3f(sq[I,J,1,1] , sq[I,J,1,2] , sq[I,J,1,3]);
glVertex3f(sq[I,J,2,1] , sq[I,J,2,2] , sq[I,J,2,3]);
glVertex3f(sq[I,J,3,1] , sq[I,J,3,2] , sq[I,J,3,3]);
glVertex3f(sq[I,J,4,1] , sq[I,J,4,2] , sq[I,J,4,3]);
end;
end;
glEnd;
glEndList;
[Subsequently during DrawGLScene:]
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslatef(0.0,0.0,-37.5);
glCallList(sphere);
Thanks for the help...
--
Mercy
-- Mercy
To use anti-aliasing use the code:
glEnable(GL_LINE_SMOOTH); //turns anti-aliasing on
glDisable(GL_LINE_SMOOTH); //turns anti-aliasing off
I can''t see any reason why your display list would decrease perfomance with your code. I''m not so familar with delphi, but try compiling the code to a release/optimized mode instead of debug, that will speed up performance in general and possibly your display lists
glEnable(GL_LINE_SMOOTH); //turns anti-aliasing on
glDisable(GL_LINE_SMOOTH); //turns anti-aliasing off
I can''t see any reason why your display list would decrease perfomance with your code. I''m not so familar with delphi, but try compiling the code to a release/optimized mode instead of debug, that will speed up performance in general and possibly your display lists
----MikePortfolio: Http://members.iinet.net.au/~slyonsTeam AI: Http://members.iinet.net.au/~slyons/teamai
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement