c++ - drawing a pixelarray fast and efficient on linux -


how can draw pixel array fast in c++?

i've seen many questions on stackoverflow,
answered with:

  • use gdi (windows)
  • use opengl
  • ...

but there must way, how opengl doing it!


i'm writing little raytracer , need draw every pixel
many times per second.
opengl able it, platform independent , fast,
how can achieve without opengl?

and "without opengl" dos not mean

  • use sdl (slow)
  • use / library

please only suggest platform native methods
or library closest that.

if possible (i know is)
how can this?
platform independent solutions preferred.

drawing graphics on linux either have use x11, or opengl. (and in near future wayland may option). in linux there no "native" way of doing graphics, because linux kernel doesn't care graphics apis. provides interfaces (drm) using graphics systems implemented in user space. if want splat pixels on screen, without caring windows mmap /dev/fbdev – don't want that, because nobody wants screen being clobbered program can't move or hide.

drawing single points inefficient, no matter api being uses, due protocol overhead.

so x11 is. best bet use mit-shm extension use alter pixels in buffer, blitted in whole x11 server. of course doing using pure x11 xlib functions annoyingly cumbersome. sdl nicely wraps you.

the other option opengl. opengl not library! it's system level api, gives direct access gpu. , integrates nicely x11. yes, api provided through library that's being loaded, technically library "wrapper" or "interface" actual driver. drawing single points opengl makes no sense. can "batch up" several points list (using vertex array) , process list. idea collect incoming points between 2 display refresh intervals , draw them in 1 single batch.

platform independent solutions preferred.

why asking native apis then? definition there can no plattform independent native api. either you're native, or you're plattform independent.

and in particular scenario think sdl best solution, because offers right kind of abstraction , program side interface raytracer. fyi: virtual machines qemu use sdl.

or use opengl real plattform neutral api supported.


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -