View Full Version : Texture Mapping vs glDrawPixels()
09-17-2001, 10:08 AM
Can somebody inform me is there any performance difference when you load a image in the background using glDrawPixels()and when you use Texture Mapping. I mean which is faster and how can we test the performance. Please reply ASAP. Any hints or some tutorials are highly appreciated.
09-17-2001, 11:16 AM
Never use glDrawPixels for that (well, not with any drivers yet available). It's damn slow from my tests.
09-18-2001, 06:28 AM
Originally posted by ashishagg:
CI mean which is faster and how can we test the performance. Please reply ASAP. Any hints or some tutorials are highly appreciated.
use Texture Mapping
if timer_1<timer_2 glDraw Pixel is faster
else Texture Mapping is faster.
09-18-2001, 06:42 AM
You may want to consider a few things first. You texture map with 2^n dimensioned images (i.e. 256x512). Ok if your images are 2^n but if not then you will have to 'pad' them out and then rescale when applying the texture to the quad. This can be very slow for loading of the texture (not displaying) and wastes memory. But if you want hardware accelerated pictures then they have to be like this (byte aligned). drawpixels will load any dimaenbsion image quickly but just redraws it slowly, oh and its easier to code (slightly) . All depends on what fits in with your app.
09-18-2001, 08:41 AM
If you have NVIDIA hardware, you could consider using rectangle textures, they don't support mipmapping, but you probably don't need that for a background image.
09-18-2001, 07:27 PM
What hardware are you using, and what exactly are you trying to do?
Scenario 1. You stream data into the graphics card to be rendered. Every frame has new data.
Scenario 2. You occasionally change the data in the image, it is used for many frames.
For scenario 2 using texture mapping is much better. The texture gets downloaded once, then re-used for multiple frames. glDrawPixels on the other hand transfers the data for every frame from the application's memory to the graphics card, wasting memory and bus bandwidth.
For scenario 1 it is likely going to depend on the size of the image, as well as the graphics card capabilities and its drivers. For our Wildcat cards using glDrawPixels will get you better performance than using textures. Images (using glDrawPixels) get transferred directly to the framebuffer. Textures on the other hand, by design, have to be transferred into texture memory first, then rasterized into the framebuffer, which is slower for streaming data that changes every frame.
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.