Per pixel precise rasterization. Possible with opengl?
Hi all,
for an application I'm developing I need to be able to
- draw lines of different widths and colours
- draw solid color filled triangles
- draw textured (no alpha) quads
Very easy...but...
All coordinates are integer in pixel space and, very important: glReading all the pixels from the framebuffer
on two different machines, with two different graphic cards, running two different OS (Linux and freebsd),
must result in exactly the same sequence of bits (given an appropriate constant format conversion).
I think this is impossible to safely be achieved using opengl and hardware acceleration, since I bet different graphic
cards (from different vendors) may implement different algorithms for rasterization.
(OpenGl specs are clear about this, since they propose an algorithm but they also state that implementations may differ
under certain circumstances).
Also I don't really need hardware acceleration since I will be rendering very low speed and simple graphics.
Do you think I can achieve this by just disabling hardware acceleration? What happens in that case under linux, will I default on
MESA software rasterizer? And in that case, can I be sure it will always work or I am missing something?
You cannot get this with OpenGL (or D3D, or any other hardware graphics API). Implementations are free to do all kinds of crazy stuff, particularly when it comes to texturing, and even where the spec says that things must be the same the drivers often simply aren't compliant (there is no OpenGL test suite or conformance toolset, so bugs and oversights are incredibly common in GL drivers).
Your needs are basic enough that implementing them in software should be fine, or you can use an existing software rendering package like SDL, SFML, Cairo, HTML5, etc. You could also write your own simple rasterizers in OpenCL/CUDA/DirectCompute and get reliably exact results if you decide later on that you need some level of hardware acceleration.