Page 1 of 1

Fastest way to set a specific pixel in screen memory

PostPosted: Jan 23, 2003 @ 6:17am
by rangers99
Hi, Im still getting to grips with GAPI programming!

Assume I want to set the pixel (u,v) to the color c. What is the quickest way to do this? Is the following code reasonable?

============================

unsigned short * pusLine = (unsigned short *)GXBeginDraw();
if (pusLine == NULL) return false;
y = 0;
while(y<v)
{
pusLine += g_gxdp.cbyPitch >> 1;
++y;
}

unsigned short *pusDest = pusLine;
x = 0;
while(x < u)
{
pusDest += g_gxdp.cbxPitch >> 1;
++x;
}
*pusDest = c;

PostPosted: Jan 23, 2003 @ 8:44am
by refractor

PostPosted: Jan 24, 2003 @ 6:24am
by rangers99

PostPosted: Jan 25, 2003 @ 12:47pm
by gamefreaks

PostPosted: Jan 25, 2003 @ 11:12pm
by Digby
If you are writing to the memory addressed by the value returned by GXBeginDraw AND GXIsDisplayDRAMBuffer returns a non-zero value, then you must call GXEndDraw each frame, regardless of the platform.