cYrus
cYrus

Reputation: 2617

Fast pixel drawing library

My application produces an "animation" in a per-pixel manner, so i need to efficiently draw them. I've tried different strategies/libraries with unsatisfactory results especially at higher resolutions.

Here's what I've tried:

(NOTE: I'm maybe wrong about these assertions, if it's so please correct me)

What I need is the following:

Can you please give me some enlightenment/ideas/suggestions?

Upvotes: 2

Views: 6469

Answers (3)

BЈовић
BЈовић

Reputation: 64223

Looks like you are confusing window manager (SDL and xlib) with rendering library (opengl).

Just pick a window manager (SDL, glut, or xlib if you like a challenge), activate double buffer mode, and make sure that you got direct rendering.

What kind of graphical card do you have? Most likely it will process pixels on the GPU. Look up how to create pixel shaders in opengl. Pixel shaders are processing per pixel.

Upvotes: 0

SingleNegationElimination
SingleNegationElimination

Reputation: 156158

I'm not totally sure what you're doing wrong, but it could be that you are writing pixels one at a time to the display surface.

Don't do that.

Instead, create a rendering surface in main memory in the same format as the display surface to render to, and then copy the whole, rendered image to the display in a single operation. Modern GPU's are very slow per transaction, but can move lots of data very quickly in a single operation.

Upvotes: 1

hotpaw2
hotpaw2

Reputation: 70703

Are your pixels sparse or dense (e.g. a bitmap)? If you are creating dense bitmaps out of pixels, then another option is to convert the bitmap into an OpenGL texture and use OpenGL APIs to render at some framerate.

The basic problem is that graphics hardware will be very different on different hardware platforms. Either you pick an abstraction layer, which slows things down, or code more closely to the type of graphics hardware present, which isn't portable.

Upvotes: 4

Related Questions