[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: OpenGL question
On Tue, 11 Feb 2003 voidstar@tin.it wrote:
> does anybody knows if and how can I do a thing like
> this in OpenGL?
>
> unsigned char* pA000 = vga_getgraphmem();
> pA000[pos] = color;
You can't (nor are you ever likely to be able to).
There are multiple problems with such a thing:
1) The graphics card is HEAVILY pipelined during OpenGL
operations - when you draw a polygon, it may not appear
on the screen until several milliseconds later. If you
could just do raw screen accesses, who knows what partial
junk you'd read.
2) There is no guarantee that there *are* any pixels laid
out simply in memory. The if you are doing FSAA with the
nVidia GeForce cards (for example), they are rending to a
multi-sample buffer with up to four RGB samples per pixel.
The new GeForceFX (if it ever appears) aparrently adaptively
stores either whole pixels or partial sub-pixels depending
on whether the pixel lies on the edge of a polygon or not.
3) What about windows that are partially overlaid by other
windows?
Basically, this has not been possible since maybe the second generation
of 3D graphics cards - and it's NEVER likely to be possible again.
The simplistic idea that one memory-location == one pixel == one
spot on the display is no longer valid with windowing systems,
3D and antialiasing.
> With svgalib i can do this, but in OpenGL? Is there
> a way to access the screen like an array (not only 320x200,
> but also 640x480, etc.)
No...nor should there be. Raw screen access died a couple of
generations of hardware ago - and I didn't shed a tear to see it
go!
I would lay very good odds that whatever it is that you are
trying to do with raw screen access could be done more efficiently
using the OpenGL API.
----
Steve Baker (817)619-2657 (Vox/Vox-Mail)
L3Com/Link Simulation & Training (817)619-2466 (Fax)
Work: sjbaker@link.com http://www.link.com
Home: sjbaker1@airmail.net http://www.sjbaker.org