Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

holy

video memory

This topic is 6499 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
I think that you can only create surfaces (if you are using DirectX) or you could just make a pointer into the memory. What would you want them in Video memory for anyway? System memory is faster and VMem only handles the output (for me anyway).

For old DOS fun:

char *ScreenSeg;
ScreenSeg = 0xA000;
*(ScreenSeg + (y*width) + x) = myColor




-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-Chris Bennett of Dwarfsoft
"The Philosophers' Stone of Programming Alchemy"
IOL (The list formerly known as NPCAI) - A GDNet production
Our Doc - The future of RPGs
Thanks to all the goblins over in our little Game Design Corner niche
          

Share this post


Link to post
Share on other sites
for watcom c++:
char *VideoBuf=(char*)0xa0000L;
for windows:
char far *pt;
long FAR PASCAL _export WndProc(HWND hwnd,unsigned iMessage,WORD wParam,LONG lParam)
{ UINT selector1,selector2;
WORD segment, offset, start;
DWORD base,limit;
int i;
_asm mov selector1,ds // get the data seg.
selector2=AllocSelector(selector1); // allocate a new selector
if (selector2==NULL) return FALSE;
segment=0xa000;
start=0;
offset=0x10000;
base=((unsigned long)segment)<<4|start; // get the base addr.
limit=offset-1;
SetSelectorBase(selector2,base);
SetSelectorLimit(Selector2,limit);
pt=(char far*)((((unsigned long)selector2)<<16)|0x0000);

for (i=0;i<100;i++) pt=i; // now you can access video memory
FreeSelector(Selector2);
}




I am a game programming fan in china

Share this post


Link to post
Share on other sites
Or you could use plain Win32 and create a device independant bitmap (DIB). The CreateDIBSection will give you a pointer to a pixel buffer.

Some snippets:
    
BITMAPINFO bmi;
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biWidth = iWidth;
bmi.bmiHeader.biHeight = -iHeight;
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 24;
bmi.bmiHeader.biCompression = BI_RGB;
bmi.bmiHeader.biSizeImage = 0;
bmi.bmiHeader.biXPelsPerMeter = 0;
bmi.bmiHeader.biYPelsPerMeter = 0;
bmi.bmiHeader.biClrUsed = 0;
bmi.bmiHeader.biClrImportant = 0;
bmi.bmiColors[0].rgbBlue = 0;
bmi.bmiColors[0].rgbGreen = 0;
bmi.bmiColors[0].rgbRed = 0;
bmi.bmiColors[0].rgbReserved = 0;

if ((hBitmap = CreateDIBSection(hDCCompat, &bmi, DIB_RGB_COLORS, (void **)&pBuffer, NULL, 0)) == NULL)
{ throw "Failed to Create Device Independed Bitmap (DIB)";
}

if ((hBitmapPrev = SelectObject(hDCCompat, hBitmap)) == NULL)
{ throw "Failed to SelectObject the DIB";
}


You probably can re-write it to your needs...

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!