// Filename : Dbuff1.c // Coded by : Scott Evans // Created/Modified : 16/9/97 // Description : Demonstrates double buffering using high level graphics functions // Header file for Yaroze library #include // The packet buffer must be large enough to store the // maximum number of primitives that will be used // In this program we are only using one primitive a GsBOXF #define PBSIZE 1*sizeof(GsBOXF) // Z resolution of ordering table #define OT_LENGTH 1 // Screen width and height (NTSC) #define SCRNW 320 #define SCRNH 240 // Define 2 ordering tables GsOT mainOT[2]; GsOT_TAG OTTags[2][1<>1; box.y=(SCRNH-box.h)>>1; box.r=box.g=box.b=0xff; // Main loop while(1) { // Find the active buffer (0 or 1) current_buffer=GsGetActiveBuff(); // Set the packet buffer for the current buffer GsSetWorkBase((PACKET *)PacketBuffer[current_buffer]); // Initialise the ordering table GsClearOt(0,0,&mainOT[current_buffer]); // Put the box primitive into the ordering table GsSortBoxFill(&box,&mainOT[current_buffer],0); // Wait for drawing and vertical blank to finish DrawSync(0); VSync(0); // Swap the buffers GsSwapDispBuff(); // Clear the screen in red GsSortClear(0x80,0x0,0x0,&mainOT[current_buffer]); // Execute the primitives in the ordering table GsDrawOt(&mainOT[current_buffer]); } exit(0); }