PDA

View Full Version : Adress of Video Memory. Where is A000:0000?



04-11-2002, 12:21 AM
Hello.
I am looking for the adress of the video memory. It used to be A000:0000 when I used to work with the mode 13h.

Where is it when I use opengl?
( I use glutFullScreen and I use Windows, Visual C++ )

Thank you very much http://www.opengl.org/discussion_boards/ubb/smile.gif

Obliviator
04-11-2002, 12:38 AM
Originally posted by 2D Man:
Hello.
I am looking for the adress of the video memory. It used to be A000:0000 when I used to work with the mode 13h.

Where is it when I use opengl?
( I use glutFullScreen and I use Windows, Visual C++ )

Thank you very much http://www.opengl.org/discussion_boards/ubb/smile.gif

you can't access the video memory in the linear fashion as it was possible in mode 13h, because of memory bank switches, which are used for higher resolution/bitdepth video modes.
why do you need to access the vmem with opengl?

04-11-2002, 01:40 AM
Thank you for your answer. I am quite surprised that such an adress doesn t exist with OpenGL, because when I used to work with DirectDraw, I could get such an adress :
LPDIRECTDRAWSURFACE could give me the adress where I could write my pixels on my own.

I want to get this adress in order to write my own 2D function to write with fonts faster than OpenGL. I used glRasterPos and glDrawBitmap, but it goes very to slow! even when I disable DEPTH_TEST, Texture, blending, zoom factor... etc.

Thank you http://www.opengl.org/discussion_boards/ubb/smile.gif

04-11-2002, 01:48 AM
I am surprised of your answer because with Direct Draw, you can get the adress of a DIRECTDRAWSURFACE, by using Lock, GetSurface, and UnLock.
Anyway, I want this adress because I find 2D copy really too slow, even when I disable Texture, DepthTest, Zoom, Blending, and whatever you want.
Thank you very much http://www.opengl.org/discussion_boards/ubb/smile.gif

Bob
04-11-2002, 01:55 AM
What if you get the address to the video memory, what are you supposed to do then? Since the OpenGL spec doesn't say the frame buffer has to be of a specific format, you can never know how the data is actually stored in the frame buffer. You don't know if it's interleaved RGB, RGBA, BGR, BGRA, ABGR or anything else, or even three/four separate buffers, one for each channel. Thats problems witht he format only. Other problems can be row pitch (or what it's called). If a row is 640 pixels wide, the graphics board might pad the row to 1024 pixels for more effective address calculation, and how are you supposed to know if that's the case?

Do a search on "pointer to frame buffer", or similar, in the suggestions forum. It has been discussed lot's of times before.

And as you say, in DirtyDraw you must lock the frame buffer before you can use it. That means the pointer you get may not be the pointer to the frame buffer itself, but a copy of it. The reasons can be the driver need to convert the contents of the frame buffer to a format the user can use, and when you unlock it, it gets converted back again.

04-11-2002, 01:19 PM
Originally posted by 2D man:

I want to get this adress in order to write my own 2D function to write with fonts faster than OpenGL. I used glRasterPos and glDrawBitmap, but it goes very to slow!

By the way, if you want to do 2D (this is your case), a faster way is to write to a simple block of system memory your text, bind it as a texture and let OpenGL render it as a flat quad in front of the screen. This is easily done with glOrtho(). I'm sure the exact use of this function to do 2D is found on this forum archives.

Regards,

NordFenris
04-14-2002, 12:26 AM
Use gluOrtho2D like this:

glMatrixMode (GL_PROJECTION);
gluOrtho2D (0, 640, 0, 480);
glMatrixMode (GL_MODELVIEW);
glLoadIdentity();
//Do your 2D drawing here, remember inverted Y axis!