Sign in to follow this  
3Dgonewild

Drawing pixels really fast...

Recommended Posts

Hi everyone... how is it going ? Im here again for yet another question. I would like to know which is the fastest way to draw a few pixels on screen. OGL has specific functions for zooming/drawing pixels? or i will have to go with 1x1 GL_QUAD |OR| GL_POINTS and a hard-coded function for scaling a set of pixels? Thanks.

Share this post


Link to post
Share on other sites
Well , actually im coding an S.M.S emulator, so there aren't going to be any textures.

I will have to render a large amount of pixels on the screen , and im looking for pixel-specific functions(IF there are).

Thanks for the help , though.

Share this post


Link to post
Share on other sites
Hi,
perhaps it would help if you could be more specific on what you want to do.

If you just want some colored pixels on your screen, I think GL_POINTS or GL_QUADS is the fastest way to do this (or at least fast enough).
You could probably also generate a texture and draw it in ortho mode.

Bye, Michael

[edit] okay, too slow... ;-)
Have you tried drawing points in ortho mode? is the rendering speed really a problem?

Share this post


Link to post
Share on other sites
Quote:
Original post by kroneml
Hi,
perhaps it would help if you could be more specific on what you want to do.

If you just want some colored pixels on your screen, I think GL_POINTS or GL_QUADS is the fastest way to do this (or at least fast enough).
You could probably also generate a texture and draw it in ortho mode.

Bye, Michael


Like i said in my previous message(i think you missed it judging by the time you posted :D ) , its going to be an emulator.



Thanks for the help.

Share this post


Link to post
Share on other sites
It doesn't matter if "there are no textures". Just create one in memory to write too and then texture that to a fullscreen quad using glOrtho mode. That's the fastest way to draw pixels to the screen

-me

Share this post


Link to post
Share on other sites
Quote:

[edit] okay, too slow... ;-)
Have you tried drawing points in ortho mode? is the rendering speed really a problem?


No i haven't tried , but i just doing some research before i actually start coding the renderer.


Quote:

It doesn't matter if "there are no textures".
Just create one in memory to write too and then texture that to a fullscreen quad using glOrtho mode. That's the fastest way to draw pixels to the screen


I see ... thanks!, so i will have to follow these steps:

*create an empty "texture"(outside main loop)
*Modify the pixels of the texture at runtime
*Bind the texture
*Render a quad equal to screen bounds

I got it right?

Share this post


Link to post
Share on other sites
If you're writing an emulator and all you need to do is push pixels, then there's zero point in using OpenGL at all. Use a simpler, software-based rasterizer that already exists, or roll your own.

SDL or TinyPTC would make good choices, if you don't want to do all the low-level stuff (though its not at all that hard for basic pixel plotting and simple primitives/bitmaps.)

Share this post


Link to post
Share on other sites
Whether or not you're using TinyPTC, an OpenGL texture, or whatever... some optimizations will generally be the same:

1) Don't try to use a "DrawPixel" function if you're filling the screen...
The overhead of a function call is higher than the time needed to actually change the color of a pixel. Blit your graphics to the screen with fast memory copies wherever possible.

2) Try not to draw "empty" pixels... for example a large sprite with lots of transparent areas can be drawn more quickly if you optimize your data to only store and draw the "useful" pixels. Check out RLE formats.

3) Profile your code often, and don't be afraid of writing different rendering code for different situations... filling a large area with a single background color can be simpler (and faster) than filling a large area with an image.

hope this helps...

Share this post


Link to post
Share on other sites
Quote:
Original post by Kwizatz
glDrawPixels?


lol!I will check it out , thanks!


Quote:
Original post by Ravyne
If you're writing an emulator and all you need to do is push pixels, then there's zero point in using OpenGL at all. Use a simpler, software-based rasterizer that already exists, or roll your own.

SDL or TinyPTC would make good choices, if you don't want to do all the low-level stuff (though its not at all that hard for basic pixel plotting and simple primitives/bitmaps.)


Well , im using openGL for all my projects , i also have a ready-to-use opengl framework ...so , why bother with anything else?


Quote:
Original post by sox
Blit your graphics to the screen with fast memory copies wherever possible.

Unfortunately , this isn't possible ... memory areas need hardcoded shifting ...

Quote:
Original post by sox
Try not to draw "empty" pixels... for example a large sprite with lots of transparent areas can be drawn more quickly if you optimize your data to only store and draw the "useful" pixels. Check out RLE formats.

Well , this will add extra code to be executed at runtime wich will cause slowdown ... since i will
have to modify dynamic memory which changes almost on each x cycles...not static.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this