PDA

View Full Version : can I get the address where the framebuffer starts???



celic
06-06-2002, 04:33 AM
how can I get the video address in openGL???

Bob
06-06-2002, 05:22 AM
You can't, and even if you can, you can't know for sure whats in there since the specification doesn't say anything about how the individual pixels in the framebuffer is supposed to be stored. Search the forum for more details.

dorbie
06-06-2002, 07:27 AM
There is no associated address. The framebuffer starts at position 0,0 in the glReadPixels call :-)

zen
06-06-2002, 07:36 AM
I believe that's more of a windowing system question.For example XFree86(*nix OS) has the DGA extension which can be used for that(as well as other)purposes.For widoze though I don't have a clue.

knackered
06-06-2002, 09:57 AM
Well, I did a quick search on google, and came up with this (obviously we're talking about the front 'entire desktop' buffer):-



#include <sys/neaptr.h> // Protected mode enable/disable

// This function is SLOOOW. Call it at the start of your program
if (__djgpp_nearptr_enable() == 0) // Remember, won't always work!
exit(EXIT_FAILURE); // Or whatever


// You have to do the add each time you set a pixel, because
// __djgpp_conventional_base can change at any time
unsigned char* screenptr = (unsigned char *)(__djgpp_conventional_base + 0xA0000);

// Here's the cool part, a red pixel the easy way
screenptr[320 * y + x] = 4;

// At the end of your program: turn memory protection back on, please
__djgpp_nearptr_disable();


Here's the web page:- http://www-scf.usc.edu/~akotaobi/gptut2.html

[This message has been edited by knackered (edited 06-06-2002).]

dorbie
06-06-2002, 10:52 AM
Run, don't walk, away.

knackered
06-06-2002, 11:08 AM
No celic, just think of all the image post-processing you could do with that level of access... http://www.opengl.org/discussion_boards/ubb/wink.gif

Nutty
06-06-2002, 01:49 PM
djgpp rocks!! http://www.opengl.org/discussion_boards/ubb/smile.gif

LordKronos
06-07-2002, 02:22 AM
I think that code is for mode 13h or something. Notice the index: [320*y+x]
That indicates a resolution of 320 pixels wide. Alsp notice each pixel is an unsigned char? Means you are in color index mode (256 colors). I doubt this code will help much with openGL (unless you are talking about some DOS openGL implementation).


[This message has been edited by LordKronos (edited 06-07-2002).]

celic
06-07-2002, 05:49 AM
thanks! http://www.opengl.org/discussion_boards/ubb/confused.gif

coredump
06-07-2002, 05:52 AM
you can manipulate the final on-screen image with a big magnet http://www.opengl.org/discussion_boards/ubb/smile.gif

b