Esempio n. 1
0
void hello_loop(helloObjectInstance *me) {
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	gluPerspective(70, 256.0 / 192.0, 0.1, 10);
	glPolyFmt(POLY_ALPHA(31) | POLY_CULL_FRONT);
	
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	
	glTranslatef(0, 0, -5);
	
	glRotateX(ry++);
	glRotateY(rx++);
	
	DSGM_DrawCube(-1, -1, -1, 2, 2, 2);
}
Esempio n. 2
0
int main()
{

	float rotateX = 0.0;
	float rotateY = 0.0;

	//set mode 0, enable BG0 and set it to 3D
	videoSetMode(MODE_0_3D);

	// initialize gl
	glInit();
	
	// enable antialiasing
	glEnable(GL_ANTIALIAS);
	
	// setup the rear plane
	glClearColor(0,0,0,31); // BG must be opaque for AA to work
	glClearPolyID(63); // BG must have a unique polygon ID for AA to work
	glClearDepth(0x7FFF);

	//this should work the same as the normal gl call
	glViewport(0,0,255,191);

	//any floating point gl call is being converted to fixed prior to being implemented
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	gluPerspective(70, 256.0 / 192.0, 0.1, 40);
	
	gluLookAt(	0.0, 0.0, 1.0,		//camera possition
				0.0, 0.0, 0.0,		//look at
				0.0, 1.0, 0.0);		//up

	while(1)
	{
		glPushMatrix();

		//move it away from the camera
		glTranslatef32(0, 0, floattof32(-1));

		glRotateX(rotateX);
		glRotateY(rotateY);


		glMatrixMode(GL_MODELVIEW);



		//not a real gl function and will likely change
		glPolyFmt(POLY_ALPHA(31) | POLY_CULL_NONE);

		scanKeys();

		u16 keys = keysHeld();

		if((keys & KEY_UP)) rotateX += 3;
		if((keys & KEY_DOWN)) rotateX -= 3;
		if((keys & KEY_LEFT)) rotateY += 3;
		if((keys & KEY_RIGHT)) rotateY -= 3;

		//draw the obj
		glBegin(GL_QUAD);

			glColor3b(255,0,0);
			glVertex3v16(inttov16(-1),inttov16(-1),0);

			glColor3b(0,255,0);
			glVertex3v16(inttov16(1), inttov16(-1), 0);

			glColor3b(0,0,255);
			glVertex3v16(inttov16(1), inttov16(1), 0);

			glColor3b(255,0,255);
			glVertex3v16(inttov16(-1), inttov16(1), 0);

		glEnd();

		glPopMatrix(1);

		glFlush(0);

		swiWaitForVBlank();

		if(keys & KEY_START) break;
	}

	return 0;
}//end main
Esempio n. 3
0
void RubiksCube::Draw(touchPosition touchXY)
{
	int viewport[]={0,0,255,191}; // used later for gluPickMatrix()
	
	int16 vx, vy, vz, vsize;
	vx = f32tov16(Position.X);
	vy = f32tov16(Position.Y);
	vz = f32tov16(Position.Z);
	vsize = f32tov16(Size);

	glPushMatrix();
	{
		glRotateY(90);
		glRotateZ(180);
		
		if(Twisting||AutoTwisting)
		{
			int ax=0;
			// Rotate so we draw the cube the right way round
			while(ax<Twist.axis)
			{
				glRotateX(90);
				glRotateZ(90);
				ax++;
			}

			if(Twist.position==0 || Twist.position==3) glRotateZ(Twist.rotation);
			DrawSide(Twist.left.side,Twist.axis,Position.X,Position.Y,Position.Z,Size,false);
			glBegin(GL_QUADS);
				glColor3f(0,0,0);
				glVertex3v16(vx + vsize, vy, vz + f32tov16(divf32(Size,inttof32(3))));
				glVertex3v16(vx, vy, vz + f32tov16(divf32(Size,inttof32(3))));
				glVertex3v16(vx, vy + vsize, vz + f32tov16(divf32(Size,inttof32(3))));
				glVertex3v16(vx + vsize, vy + vsize, vz + f32tov16(divf32(Size,inttof32(3))));
			glEnd();
			if(Twist.position==0 || Twist.position==3) glRotateZ(-Twist.rotation);
			glRotateY(180);
			if(Twist.position==2 || Twist.position==3) glRotateZ(-Twist.rotation);
			DrawSide(Twist.right.side,Twist.axis+3,Position.X,Position.Y,Position.Z,Size,false);
			glBegin(GL_QUADS);
				glColor3f(0,0,0);
				glVertex3v16(vx + vsize, vy, vz + f32tov16(divf32(Size,inttof32(3))));
				glVertex3v16(vx, vy, vz + f32tov16(divf32(Size,inttof32(3))));
				glVertex3v16(vx, vy + vsize, vz + f32tov16(divf32(Size,inttof32(3))));
				glVertex3v16(vx + vsize, vy + vsize, vz + f32tov16(divf32(Size,inttof32(3))));
			glEnd();
			if(Twist.position==2 || Twist.position==3) glRotateZ(Twist.rotation);
			glRotateY(90);
			glRotateX(-90);
			if(Twist.position==1 || Twist.position==3) glRotateX(Twist.rotation);
			glBegin(GL_QUADS);
				glColor3f(0,0,0);
				glVertex3v16(vx + f32tov16(divf32(Size,inttof32(3))), vy, vz);
				glVertex3v16(vx + f32tov16(divf32(Size,inttof32(3))), vy + vsize, vz);
				glVertex3v16(vx + f32tov16(divf32(Size,inttof32(3))), vy + vsize, vz + vsize);
				glVertex3v16(vx + f32tov16(divf32(Size,inttof32(3))), vy, vz + vsize);
				glVertex3v16(vx + f32tov16(divf32(Size,inttof32(3)))*2, vy, vz);
				glVertex3v16(vx + f32tov16(divf32(Size,inttof32(3)))*2, vy, vz + vsize);
				glVertex3v16(vx + f32tov16(divf32(Size,inttof32(3)))*2, vy + vsize, vz + vsize);
				glVertex3v16(vx + f32tov16(divf32(Size,inttof32(3)))*2, vy + vsize, vz);
			glEnd();
			if(Twist.position==1 || Twist.position==3) glRotateX(-Twist.rotation);
			for(int i=0;i<4;i++)
			{
				if(Twist.position==0) glRotateX(Twist.rotation);
				DrawLine(Twist.left.line[i],Position.X,Position.Y,Position.Z,Size/3);
				if(Twist.position==0) glRotateX(-Twist.rotation);
				if(Twist.position==1) glRotateX(Twist.rotation);
				DrawLine(Twist.middle.line[i],Position.X+(Size/3),Position.Y,Position.Z,Size/3);
				if(Twist.position==1) glRotateX(-Twist.rotation);
				if(Twist.position==2) glRotateX(Twist.rotation);
				DrawLine(Twist.right.line[i],Position.X+(Size/3*2),Position.Y,Position.Z,Size/3);
				if(Twist.position==2) glRotateX(-Twist.rotation);
				glRotateX(90);
			}
		}else{
			for(int i=0;i<3;i++)
			{
				DrawSide(Side[i],i,Position.X,Position.Y,Position.Z,Size, false);
				glRotateY(180);
				DrawSide(Side[i+3],i+3,Position.X,Position.Y,Position.Z,Size, false);
				glRotateX(90);
				glRotateZ(-90);
			}
		}
	}
	glPopMatrix(1);
	
	
	if(Picking)
	{
		glPushMatrix();
		for(int i=0;i<3;i++)
			clicked[i]=0;
		closeW = 0x7FFFFFFF; //reset the distance
		
		//set the viewport to just off-screen, this hides all rendering that will be done during picking
		glViewport(0,192,0,192);
		
		// setup the projection matrix for picking
		glMatrixMode(GL_PROJECTION);
		glLoadIdentity();
		gluPickMatrix((touchXY.px),(191-touchXY.py),4,4,viewport); // render only what is below the cursor
		gluPerspective(70, 256.0 / 192.0, 0.1, 20); // this must be the same as the original perspective matrix
		
		glMatrixMode(GL_MODELVIEW); // switch back to modifying the modelview matrix for drawing
		
		{
			glRotateY(90);
			glRotateZ(180);
			for(int i=0;i<3;i++)
			{
				DrawSide(Side[i],i,Position.X,Position.Y,Position.Z,Size, true);
				glRotateY(180);
				DrawSide(Side[i+3],i+3,Position.X,Position.Y,Position.Z,Size, true);
				glRotateX(90);
				glRotateZ(-90);
			}
		}
		
		glViewport(0,0,255,191);
		glMatrixMode(GL_PROJECTION);
		glLoadIdentity();
		gluPerspective(70, 256.0 / 192.0, 0.1, 20);
		glMatrixMode(GL_MODELVIEW);
		
		if(closeW<0x7FFFFFFF)
		{
			if(Painting)
			{
				if(Side[clicked[0]].tile[clicked[1]][clicked[2]].color!=paintColour)
				{
					if(undoQueue.numEntries==0)
					{
						undoQueue.numEntries++;
						undoQueue.currentEntry=0;
					}
					else if(undoQueue.currentEntry < (undoQueue.numEntries-1))
					{
						undoQueue.currentEntry++;
						undoQueue.numEntries=undoQueue.currentEntry+1;
					}
					else if(undoQueue.numEntries==20)
					{
						for(int i=0; i<19; i++)
						{
						undoQueue.entry[i]=undoQueue.entry[i+1];
						}
					}
					else
					{
						undoQueue.numEntries++;
						undoQueue.currentEntry++;
					}
					undoQueue.entry[undoQueue.currentEntry].from=Side[clicked[0]].tile[clicked[1]][clicked[2]].color;
					undoQueue.entry[undoQueue.currentEntry].to=paintColour;
					for(int i=0; i<3; i++)
						undoQueue.entry[undoQueue.currentEntry].position[i]=clicked[i];
				
					Side[clicked[0]].tile[clicked[1]][clicked[2]].color=paintColour;
				}
			}else{
				Grabbing=true;
				Picking=false;
			}
		}
		glPopMatrix(1);
	}else{
		//Twisting=false;
	}
}
Esempio n. 4
0
//---------------------------------------------------------------------------------
// Updates the Rubik's Cube, called once per frame. The general workhorse function
// of the class. Handles Grabbing/Twisting, and calls the Draw() function.
//---------------------------------------------------------------------------------
void RubiksCube::Update(bool moving, touchPosition touchXY, VECTOR touchVector, bool painting, int colour)
{
	Painting=painting;
	paintColour=colour;
	if(!painting)
	{
		undoQueue.numEntries=0;
		undoQueue.currentEntry=-1;
	}
	// somehow stumbled onto a good way to handle Twisting using states
	// F**K TOP-DOWN PLANNING; PROTOTYPING FTW!
	if (moving && !Grabbing && !Twisting)
	{
		Picking=true;
	}
	if(!moving)
	{
		if(Twisting)
		{
			if(Twist.rotation%90>=45) Twist.direction=true;
			else Twist.direction=false;
			TwistAgain();
		}
		Picking=false;
		Grabbing=false;
		Twisting=false;
	}

	if(AutoTwisting)
		TwistAgain();

	if((!AutoTwisting) && Scrambling)
	{
		//printf("(!AutoTwisting) && Scrambling\n");
		AutoTwist(rand()%3, rand()%3, !(!(rand()%2)));
	}
	
	if((!AutoTwisting) && Solving)
	{
		int tmp = solver.mov[0]-solvecount;
		AutoTwist(solution[tmp][0], solution[tmp][1], (!(!solution[tmp][2])));
	}

	
	if(Twisting)
	{
		int32 touchVf32[3];
		int32 twistVf32[3];
		
		touchVf32[0]=floattof32(touchVector.X*twistSensitivity);
		touchVf32[1]=floattof32(touchVector.Y*twistSensitivity);
		touchVf32[2]=0;
		
		twistVf32[0]=Twist.vector[0];
		twistVf32[1]=Twist.vector[1];
		twistVf32[2]=0;
		
		int32 twistyness = dotf32(twistVf32, touchVf32);
		Twist.rotation+=f32toint(twistyness);
		if (Twist.rotation<0)
			Twist.rotation+=360;
	}
	
	//move the cube
	glRotateX(ry);
	glRotateY(rx);
	
	
	if(Grabbing) Grab(touchVector);
	
	Draw(touchXY);
}
Esempio n. 5
0
int main(void)
{
    float x_angle = 0, y_angle = 0;
    float x_speed = 0, y_speed = 0;
    float distance = 1;

    powerON(POWER_ALL);
    irqInit();
    irqEnable(IRQ_VBLANK);
    videoSetMode(MODE_0_3D);
    consoleDemoInit();

    /* Set up a timer to count FPS */
    TIMER3_DATA = TIMER_FREQ_1024(1);
    TIMER3_CR = TIMER_DIV_1024 | TIMER_IRQ_REQ;
    irqSet(IRQ_TIMER3, fps_timer_irq);
    irqEnable(IRQ_TIMER3);

    glViewPort(0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1);
    glClearColor(0, 0, 0);
    glClearDepth(GL_MAX_DEPTH);

    iprintf("Hello World!\n\n");

    glReset();
    gluPerspective(35, SCREEN_WIDTH / (float) SCREEN_HEIGHT, 0.1, 40.0);
    gluLookAt(0.0, 0.0, 1.0,   /* Eye */
	      0.0, 0.0, 0.0,   /* Look at */
	      0.0, 1.0, 0.0);  /* Up */

    glMaterialf(GL_AMBIENT, RGB15(8,8,8));
    glMaterialf(GL_DIFFUSE, RGB15(16,16,16));
    glMaterialf(GL_SPECULAR, BIT(15) | RGB15(8,8,8));
    glMaterialf(GL_EMISSION, RGB15(5,5,5));
    glMaterialShinyness();
    glColor(RGB15(31, 31, 31));

    glLight(0, RGB15(20, 15, 15),
	    floattov10(-0.9),
	    floattov10( 0.9),
	    floattov10( 0.2));

    glLight(1, RGB15(15, 15, 20),
	    floattov10( 0.4),
	    floattov10( 0.9),
	    floattov10( 0.2));

    glPolyFmt(POLY_ALPHA(31) | POLY_CULL_BACK |
	      POLY_FORMAT_LIGHT0 | POLY_FORMAT_LIGHT1);

    while (1) {
	scanKeys();
	if (keysHeld() & KEY_START)  Loader_Exit9();
	if (keysHeld() & KEY_UP)     x_speed += 0.05;
	if (keysHeld() & KEY_DOWN)   x_speed -= 0.05;
	if (keysHeld() & KEY_LEFT)   y_speed += 0.05;
	if (keysHeld() & KEY_RIGHT)  y_speed -= 0.05;
	if (keysHeld() & KEY_R)      distance += 0.05;
	if (keysHeld() & KEY_L)      distance -= 0.05;

	glPushMatrix();

	glTranslate3f32(floattof32( 0.0),
			floattof32( 0.0),
			floattof32(-distance));

	glRotateX(x_angle += x_speed);
	glRotateY(y_angle += y_speed);

	glCallList(display_list_bin);

	glPopMatrix(1);

	glFlush();
	frames++;
	swiWaitForVBlank();
    }

    return 0;
}
Esempio n. 6
0
int main() {	
	
	int textureID;

	float rotateX = 0.0;
	float rotateY = 0.0;

	//set mode 0, enable BG0 and set it to 3D
	videoSetMode(MODE_0_3D);

	// initialize gl
	glInit();
	
	//enable textures
	glEnable(GL_TEXTURE_2D);
	
	// enable antialiasing
	glEnable(GL_ANTIALIAS);
	
	// setup the rear plane
	glClearColor(0,0,0,31); // BG must be opaque for AA to work
	glClearPolyID(63); // BG must have a unique polygon ID for AA to work
	glClearDepth(0x7FFF);

	//this should work the same as the normal gl call
	glViewport(0,0,255,191);
	
	vramSetBankA(VRAM_A_TEXTURE);

	glGenTextures(1, &textureID);
	glBindTexture(0, textureID);
	glTexImage2D(0, 0, GL_RGB, TEXTURE_SIZE_128 , TEXTURE_SIZE_128, 0, TEXGEN_TEXCOORD, (u8*)texture_bin);
	
	
	//any floating point gl call is being converted to fixed prior to being implemented
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	gluPerspective(70, 256.0 / 192.0, 0.1, 40);
	
	gluLookAt(	0.0, 0.0, 1.0,		//camera possition 
				0.0, 0.0, 0.0,		//look at
				0.0, 1.0, 0.0);		//up	
	
	while(1) {
		glMatrixMode(GL_MODELVIEW);
		glPushMatrix();

		//move it away from the camera
		glTranslate3f32(0, 0, floattof32(-1));
				
		glRotateX(rotateX);
		glRotateY(rotateY);
		
		

		glMaterialf(GL_AMBIENT, RGB15(16,16,16));
		glMaterialf(GL_DIFFUSE, RGB15(16,16,16));
		glMaterialf(GL_SPECULAR, BIT(15) | RGB15(8,8,8));
		glMaterialf(GL_EMISSION, RGB15(16,16,16));

		//ds uses a table for shinyness..this generates a half-ass one
		glMaterialShinyness();

		//not a real gl function and will likely change
		glPolyFmt(POLY_ALPHA(31) | POLY_CULL_BACK);

		scanKeys();
		
		u16 keys = keysHeld();
		
		if((keys & KEY_UP)) rotateX += 3;
		if((keys & KEY_DOWN)) rotateX -= 3;
		if((keys & KEY_LEFT)) rotateY += 3;
		if((keys & KEY_RIGHT)) rotateY -= 3;
		
		glBindTexture(0, textureID);

		//draw the obj
		glBegin(GL_QUAD);
			glNormal(NORMAL_PACK(0,inttov10(-1),0));

			GFX_TEX_COORD = (TEXTURE_PACK(0, inttot16(128)));
			glVertex3v16(floattov16(-0.5),	floattov16(-0.5), 0 );
	
			GFX_TEX_COORD = (TEXTURE_PACK(inttot16(128),inttot16(128)));
			glVertex3v16(floattov16(0.5),	floattov16(-0.5), 0 );
	
			GFX_TEX_COORD = (TEXTURE_PACK(inttot16(128), 0));
			glVertex3v16(floattov16(0.5),	floattov16(0.5), 0 );

			GFX_TEX_COORD = (TEXTURE_PACK(0,0));
			glVertex3v16(floattov16(-0.5),	floattov16(0.5), 0 );
		
		glEnd();
		
		glPopMatrix(1);
			
		glFlush(0);

		swiWaitForVBlank();
	}

	return 0;
}//end main 
Esempio n. 7
0
int main()
{	
    struct touchPosition pos;
	float rotateX = 0.0;
	float rotateY = 0.0;

	powerON(POWER_ALL);
    consoleDemoInit();

	//set mode 0, enable BG0 and set it to 3D
	videoSetMode(MODE_0_3D);

	//irqs are nice
	irqInit();
	irqEnable(IRQ_VBLANK);
    
	// initialize gl
	glInit();
    
	// enable antialiasing
	glEnable(GL_ANTIALIAS);
	
	// setup the rear plane
	glClearColor(0,0,0,31); // BG must be opaque for AA to work
	glClearPolyID(63); // BG must have a unique polygon ID for AA to work
	glClearDepth(0x7FFF);

	//this should work the same as the normal gl call
	glViewPort(0,0,255,191);
    
	//any floating point gl call is being converted to fixed prior to being implemented
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	gluPerspective(35, 256.0 / 192.0, 0.1, 100);
	
	gluLookAt(	0.0, 0.0, 1.0,		//camera possition 
				0.0, 0.0, 0.0,		//look at
				0.0, 1.0, 0.0);		//up

	while(1)		
	{
        float px, py;
        
    	pos = touchReadXY();
        px = pos.px;
        py = pos.py;

        px = (px * 5) / 256;
        py = (py * 3) / 192;

        px -= 2.5;
        py -= 1.5;

		glPushMatrix();

		//move it away from the camera
		glTranslate3f32(0, 0, floattof32(-1));

		glRotateX(rotateX);
		glRotateY(rotateY);

		glMatrixMode(GL_MODELVIEW);

		//not a real gl function and will likely change
		glPolyFmt(POLY_ALPHA(31) | POLY_CULL_NONE);
        
		scanKeys();
		
		u16 keys = keysHeld();
		
		if((keys & KEY_UP)) rotateX += 3;
		if((keys & KEY_DOWN)) rotateX -= 3;
		if((keys & KEY_LEFT)) rotateY += 3;
		if((keys & KEY_RIGHT)) rotateY -= 3;
        
		//draw the obj
		glBegin(GL_TRIANGLE);
			
			glColor3b(255,0,0);
			glVertex3v16(inttov16(-1),inttov16(-1),0);

			glColor3b(0,255,0);
			glVertex3v16(inttov16(1), inttov16(-1), 0);

			glColor3b(0,0,255);
			glVertex3v16(inttov16(0), inttov16(1), 0);
			
		glEnd();

        glLoadIdentity();
        glTranslatef(px,-py,-3.0);
        glBegin(GL_TRIANGLE);
            glVertex3f( 0.0, 1.0, 0.0);
            glVertex3f(-1.0,-1.0, 0.0);
            glVertex3f( 1.0,-1.0, 0.0);
        glEnd();

		glPopMatrix(1);

		glFlush(0);
		swiWaitForVBlank();
	}

	return 0;
}//end main 
Esempio n. 8
0
int main()
{	
	
	int textureID;
	int i;
	float rotateX = 0.0;
	float rotateY = 0.0;

	//set mode 0, enable BG0 and set it to 3D
	videoSetMode(MODE_0_3D);

	// initialize gl
	glInit();
	
	//enable textures
	glEnable(GL_TEXTURE_2D);
	
	//this should work the same as the normal gl call
	glViewport(0,0,255,191);
	
	// enable antialiasing
	glEnable(GL_ANTIALIAS);
	
	// setup the rear plane
	glClearColor(0,0,0,31); // BG must be opaque for AA to work
	glClearPolyID(63); // BG must have a unique polygon ID for AA to work
	glClearDepth(0x7FFF);

	vramSetBankB(VRAM_B_LCD);
	REG_DISPCAPCNT = 
			DCAP_MODE(DCAP_MODE_BLEND) //blend source A and source B
		//|	DCAP_SRC_ADDR //this is not used since we are setting the display to render from VRAM
		|	DCAP_SRC_B(DCAP_SRC_B_VRAM)
		|	DCAP_SRC_A(DCAP_SRC_A_3DONLY)
		|	DCAP_SIZE(DCAP_SIZE_256x192)
		|	DCAP_OFFSET(0) //where to write the captured data within our chosen VRAM bank
		|	DCAP_BANK(DCAP_BANK_VRAM_B)
		|	DCAP_B(12) //blend mostly from B to make a very dramatic effect
		|	DCAP_A(4) //and blend only a little bit from the new scene
		;
	//but, dramatic effects tend to leave some garbage on the screen since the precision of the math is low,
	//and we're not putting a lot of dampening on the effect.
	//a more realistic value might be 8 and 8, but perhaps in a more complex 3d scene the garbage isn't such a bad thing
	//since the scene is changing constantly

	DisplayEnableMotionBlur();
	bool displayBlurred = true;


	vramSetBankA(VRAM_A_TEXTURE);

	glGenTextures(1, &textureID);
	glBindTexture(0, textureID);
	glTexImage2D(0, 0, GL_RGB, TEXTURE_SIZE_128 , TEXTURE_SIZE_128, 0, TEXGEN_TEXCOORD, (u8*)texture_bin);
	
	
	//any floating point gl call is being converted to fixed prior to being implemented
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	gluPerspective(70, 256.0 / 192.0, 0.1, 40);
	
	gluLookAt(	0.0, 0.0, 1.0,		//camera possition 
				0.0, 0.0, 0.0,		//look at
				0.0, 1.0, 0.0);		//up
	
	while(1) {
		
		glLight(0, RGB15(31,31,31) , 0,				  floattov10(-1.0),		 0);
		glLight(1, RGB15(31,0,31),   0,				  floattov10(1) - 1,			 0);
		glLight(2, RGB15(0,31,0) ,   floattov10(-1.0), 0,					 0);
		glLight(3, RGB15(0,0,31) ,   floattov10(1.0) - 1,  0,					 0);

		glPushMatrix();

		//move it away from the camera
		glTranslatef32(0, 0, floattof32(-1));
				
		glRotateX(rotateX);
		glRotateY(rotateY);
		
		glMatrixMode(GL_TEXTURE);
		glLoadIdentity();
		
		glMatrixMode(GL_MODELVIEW);

		glMaterialf(GL_AMBIENT, RGB15(8,8,8));
		glMaterialf(GL_DIFFUSE, RGB15(16,16,16));
		glMaterialf(GL_SPECULAR, BIT(15) | RGB15(8,8,8));
		glMaterialf(GL_EMISSION, RGB15(5,5,5));

		//ds uses a table for shinyness..this generates a half-ass one
		glMaterialShinyness();

		//not a real gl function and will likely change
		glPolyFmt(POLY_ALPHA(31) | POLY_CULL_BACK | POLY_FORMAT_LIGHT0 | POLY_FORMAT_LIGHT1 | 
													POLY_FORMAT_LIGHT2 | POLY_FORMAT_LIGHT3 ) ;
		
		scanKeys();
		
		u16 keys = keysHeld();
		
		if((keys & KEY_UP)) rotateX += 3;
		if((keys & KEY_DOWN)) rotateX -= 3;
		if((keys & KEY_LEFT)) rotateY += 3;
		if((keys & KEY_RIGHT)) rotateY -= 3;

		if(keysDown() & KEY_A)
		{
			displayBlurred = !displayBlurred;
			if(displayBlurred)
				DisplayEnableMotionBlur();
			else 
				DisplayEnableNormal();
		}
		
		glBindTexture(0, textureID);

		//draw the obj
		glBegin(GL_QUAD);
			for(i = 0; i < 6; i++)
				drawQuad(i);
		
		glEnd();
		
		glPopMatrix(1);
			
		glFlush(0);

		swiWaitForVBlank();

		if(keys & KEY_START) break;

		//the display capture enable bit must be set again each frame if you want to continue capturing.
		REG_DISPCAPCNT |= DCAP_ENABLE;
	}

	return 0;
}//end main