Page 1 of 1
Need help using memcpy with GAPI

Posted:
Sep 12, 2001 @ 5:56pm
by Vickerto
I need some help using memcpy with my GAPI app. I am using memcpy to copy a back buffer to video memory. It works great, but I am experiencing a strange occurance. The first vertical row of pixels on the screen is not being drawn (it just shows up as a white column of pixels). Has anyone run into this or does anyone know what could be happening? Thanks in advance.<br><br>Tom
Re: Need help using memcpy with GAPI

Posted:
Sep 12, 2001 @ 5:59pm
by Paul
don't ask me, i just work here.
Re: Need help using memcpy with GAPI

Posted:
Sep 12, 2001 @ 6:38pm
by Digby
If the display is native landscape (iPaq) then the address returned by GXBeginDraw is at the 0,0 position in portrait mode. In order to get the start of display RAM, you need the address of 0,0 in landscape mode (lower left pixel in portrait).<br><br>This will give you the correct address for landscape native displays:<br><br>WORD* pwScrBuf = (WORD*)GXBeginDraw() - 319;<br><br>
Re: Need help using memcpy with GAPI

Posted:
Sep 12, 2001 @ 7:17pm
by Vickerto
Looks good. Thanks. This code now works on the iPaq, but I am assuming it needs to change for MIPS and SH3, correct? Also, I am now getting exception errors when I blit to the far right side of the screen. I am guessing that this is because I am not doing any clipping as of yet, any input? Thanks.<br><br>Tom
Re: Need help using memcpy with GAPI

Posted:
Sep 12, 2001 @ 8:19pm
by Digby
You should not assume that one device or another is landscape, portrait, or a particular size. Call GXGetDisplayProperties to query what the particular device supports.<br><br>On a native landscape display oriented as portrait, the right edge is the end of the linear frame buffer. This means that if you copy memory to the right of the edge, you'll be writing into memory that doesn't belong to your process. You'll end up corrupting the display controller or if you're lucky generating an access violation. Add some clipping code and you shouldn't see this problem.<br><br><br><br>
Re: Need help using memcpy with GAPI

Posted:
Sep 22, 2001 @ 2:14pm
by David C. Allen
Tom could a get a small snippit of code showing how you are memcpying to the GAPI display memory? I have been trying to figure out how to do something like bitblit to the GAPI memory for quite some time.<br><br>Thanks!