Advertisement

A lot of trouble using glDrawPixels

Started by September 04, 2002 09:07 PM
6 comments, last by c4ctusal 22 years, 5 months ago
Hello ! I have been testing glDrawPixels for the week and have encountered some unsolvable (for the moment) problems with it. The first one is that it ran very slow on a P4 with a Rage 128, I could move no more than 45 40x40 balls on the screen before my framerate started to drop but I could do 480 of the same balls with the same code with GeForce 4 MX-460 on an Athlon XP. What''s wrong with me ! I know this function can''t perform fast because the data is not in video memory but the difference is awesome ! (If you have some idea about putting a pixel buffer in video memory without using textures it would like to know how.) Also, I want to note that my image pixel data is in RGBA as the color-buffer. I would be grateful if you show me a good place to look for to optimize my code. Thanks a lot for your help. C4ctusAl What about some trouble ?
C4ctusAlWhat about some trouble ?
There''s nothing wrong with u. I think drawpixels is quite low on the often used functions list, and as such many drivers and hardware dont optimise it much or at all. It''s just slow.
I would try not to use it if you can, see the thread in the opengl forum about it. Surely you could use a texture or other method, polygons etc to draw the balls?
Advertisement
gldrawpixel is probably the slowest way to draw pixel developed by IT industry... still want to use it?
PS.ok, bios functions for drawing pixels were even slower;P
With best regards, Mirek Czerwiñski
dont use glDrawPixels, set the modelview matrix to orthographic then use:

glBegin( GL_POINTS );
glColor3f( 1.0f, 1.0f, 1.0f ); // set your color
glVertex2f( 120,210 ); // drawpixel
glEnd();

etc...
AP, I don''t think that''s what he''s after.

c4ctusal, you say you don''t want to use a texture. Why? It would solve all your problems.


Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions
I didn''t want to use textures because of the limitation that width and height must be powers of 2 but as there are probably no other solution, I will try it this way. I have also had the idea of putting it in a display list but it made the thing poorly flexible.

Thanks a lot for your help !


C4ctusAl

What about some trouble ?
C4ctusAlWhat about some trouble ?
Advertisement
You can still use textures, and round the sizes up to the nearest powers of 2.


Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions
And if the screen size is too big you may split into multiple textures.
For instance is your resolution is 1600x1200, instead of allocating a 2048x2048 texture, you may want to allocate more than one texture : split width into 1600=1024+512+64 and split height into 1200=1024+128+32+16, then you have 12 textures covering the whole 1600x1200 screen : 1024x1024, 1024x128, 1024x32, 1024x16, 512x1024, 512x128, 512x32, 512x16, 64x1024, 64x128, 64x32 and 64x16.

This topic is closed to new replies.

Advertisement