View Full Version : Display list problem
My display list is not increasing the performance.
glPixelZoom((float)Options.WinWidth / (float)MenuBackImg->sizeX, (float)Options.WinHeight/(float)MenuBackImg->sizeY);
I have over 30 fps when calling the list and the same whn calling this commands directly.
I thoght that drawing pixels is processors job but i have only 30% processor busy.
How can I increase performance?
07-20-2006, 05:37 AM
Display lists do not have to increase performance. Also, DrawPixels may be potentially slow as it may not be hardware accelerated (I am not shure about that). If you want performance, draw your image as a texture. That is, upload the image to a texture and draw it onto a rectangle. This way you get acceleration and scaling + even more possible effects.
07-20-2006, 05:43 AM
DrawPixels with PixelZoom actually doing a scaling doesn't sound like a fast path at all.
Also note that depth test, texturing, lighting, affect DrawPixels and depend on the glRasterPos call done before. Switch them all off for a simple 2D DrawPixels.
Anyways, a much better solution is to generate a texture object with the image data, bind the texture, enable 2D texturing and draw a quad with the correct size. Scaling of the bitmap is done automatically.
Mind the PixelStore UNPACK_ALIGNMENT when using RGB data. Also make sure you use power-of-two sizes for the image. Or if they aren't, check if your adapter supports the GL_ARB_texture_non_power_of_two or GL_ARB_texture_rectangle extension. Extension docs here: http://www.opengl.org/registry/
If you don't want filtering on the image (looks like DrawPixels then), switch minification and magnification filtering to GL_NEAREST once after glBindTexture while you define the data. Later calls to glBindTexture will recall that setting.
Code for that can be found in many examples.
Edit: Double post. Yes, what he said.^^
Thank's. I heart that using display lists with raster graphics increases performance in 100's times.
Originally posted by des:
Thank's. I heart that using display lists with raster graphics increases performance in 100's times. It MAY increase performance, not WILL. Note the difference.
And when it MAY increase performance?
07-23-2006, 01:58 PM
Think about what display lists actually do:
Reduce number of function calls.
Instead of calling glColor/glNormal/glVertex/etc many times, you only call glCallList once. Store data in server/video memory.
All those vertex attributes don't need to be sent over the network or pci/agp/pcie bus anymore. Reorder/modify calls for optimal processing.
The DL compiler may insert additional vertex attributes to allow uniform processing, merge equivalent vertices, reorder triangler for better post-t&l cache usage, etc.
DL, however, don't change (and thus accelerate) how vertices are processed in general, how fragments are generated and processed, or how framebuffer operations are performed (in rare cases the DL compiler actually might do that, but you'd have to define all affecting states inside the DL).
So, unless your application is limited by one of the three points mentioned above, DL simply cannot increase performance.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.