Пример #1
0
void loseRender(Board *b, int step){
		glResetMatrixStack();
		if ( step > 1000 )
			return;
		glMatrixMode(GL_PROJECTION);
		gluPerspective(20, 256.0 / 192.0, 0.1, 40);
		
		float d = (float)step / 6.0;
		gluLookAt(	5.0 + d, 5.0 + d, 7.0 + d,		//camera possition 
					1.0, 0.0, 1.5,		//look at
					0.0, 1.0, 0.0);		//up
					
		glRotateY(step*3);

		glLight(0, RGB15(31,31,31), 0,	floattov10(1.0)-1, 0);
		glMatrixMode(GL_TEXTURE);
		glLoadIdentity();
		glMatrixMode(GL_MODELVIEW);
		glMaterialf(GL_AMBIENT, RGB15(8,8,8));
		glMaterialf(GL_DIFFUSE, RGB15(31,31,31));
		glMaterialf(GL_SPECULAR, RGB15(31,31,31));
		glMaterialf(GL_EMISSION, RGB15(8,8,8));
		glMaterialShinyness();
		glPolyFmt( POLY_ALPHA(31) | POLY_CULL_BACK | POLY_FORMAT_LIGHT0 );

		glBindTexture(0, textureID);
		b->draw();
		glFlush(0);
		swiWaitForVBlank();
}
Пример #2
0
	void init3DSettings() {
		glInit();
		glEnable(GL_TEXTURE_2D | GL_ANTIALIAS | GL_BLEND);

		glClearColor(31, 31, 31, 0);
		glClearPolyID(63);
		glClearDepth(GL_MAX_DEPTH);

		glViewport(0, 0, 255, 191);

		glMatrixMode(GL_PROJECTION);
		glLoadIdentity();

		glFrustum(-6.4, 6.4, -4.8, 4.8, 6.4, 25);

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

		glLight(0, RGB15(31, 31, 31), floattov10(4.0), 0, floattov10(-0.8));
		glLight(1, RGB15(31, 31, 31), floattov10(-4.0), 0, floattov10(-0.8));
		glLight(2, RGB15(31, 31, 31), 0, floattov10(-4.0), floattov10(-0.8));
		glLight(3, RGB15(31, 31, 31), 0, floattov10(4.0), floattov10(-0.8));

		glPolyFmt(POLY_ALPHA(31) | POLY_CULL_BACK | POLY_FORMAT_LIGHT0
				| POLY_FORMAT_LIGHT1 | POLY_FORMAT_LIGHT2 | POLY_FORMAT_LIGHT3);
	}
Пример #3
0
static void setup()
{
    consoleDemoInit();

    //put 3D on top
    lcdMainOnTop();

    //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);

    // Set our viewport to be the same size as the screen
    glViewport(0,0,255,191);

    glColor3b(255,255,0);

    glLight(0, RGB15(0,31,0) , 0,               floattov10(-1.0),      0);

    //need to set up some material properties since DS does not have them set by default
    glMaterialf(GL_AMBIENT, RGB15(5,5,5));
    glMaterialf(GL_DIFFUSE, RGB15(15,15,15));
    glMaterialf(GL_SPECULAR, RGB15(8,8,8));
    glMaterialf(GL_EMISSION, RGB15(5,5,5));

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

    //ds specific, several attributes can be set here   
    glPolyFmt( POLY_ALPHA(31) | POLY_CULL_NONE | POLY_FORMAT_LIGHT0 );

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective(60, (float)W / H, Znear, Zfar);

    lookAtSelectedModel();
}
Пример #4
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;
}
Пример #5
0
int main() {
	
	// Setup the Main screen for 3D 
	videoSetMode(MODE_0_3D);
	vramSetBankA(VRAM_A_TEXTURE);                        //NEW  must set up some memory for textures
	
	// initialize the geometry engine
	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);
	
	// enable textures
	glEnable(GL_TEXTURE_2D);
	
	// enable alpha blending
	glEnable(GL_BLEND);

	// Set our viewport to be the same size as the screen
	glViewport(0,0,255,191);
	
	LoadGLTextures();
	
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	gluPerspective(70, 256.0 / 192.0, 0.1, 100);
	glColor3f(1,1,1);
	
	//set up a directional ligth arguments are light number (0-3), light color, 
	//and an x,y,z vector that points in the direction of the light
	glLight(0, RGB15(31,31,31) , 0, 0,floattov10(-1.0));
	
	//need to set up some material properties since DS does not have them set by default
	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();
	
	glPolyFmt(POLY_ALPHA(15) | POLY_CULL_BACK  | POLY_FORMAT_LIGHT0);

	glMatrixMode(GL_MODELVIEW);
	
	while (1) {
		DrawGLScene();
		
		// flush to screen	
		glFlush(0);
		
		// wait for the screen to refresh
		swiWaitForVBlank();
	}
	
	return 0;
}
Пример #6
0
void logo()
{
	glResetMatrixStack();
	glMatrixMode(GL_PROJECTION);
	gluPerspective(20, 256.0 / 192.0, 0.1, 40);

	gluLookAt(	0.0, .55, 0.0 ,		//camera possition 
				0.0, 0.0, 0.0,		//look at
				0.0, 0.0, -1.0);		//up
				


	glLight(0, RGB15(31,31,31), 0,	floattov10(1.0)-1, 0);
	glMatrixMode(GL_TEXTURE);
	glLoadIdentity();
	glMatrixMode(GL_MODELVIEW);
	
	glMaterialf(GL_AMBIENT, RGB15(8,8,8));
	glMaterialf(GL_DIFFUSE, RGB15(31,31,31));
	glMaterialf(GL_SPECULAR, RGB15(31,31,31));
	glMaterialf(GL_EMISSION, RGB15(8,8,8));
	glMaterialShinyness();
	glPolyFmt( POLY_ALPHA(31) | POLY_CULL_BACK | POLY_FORMAT_LIGHT0 );
		
		
	glGenTextures(1, &logotex);
	glBindTexture(0, logotex);
	glTexImage2D(0, 0, GL_RGB, TEXTURE_SIZE_256 , TEXTURE_SIZE_256, 0, TEXGEN_TEXCOORD , (u8*)billkuker_bmp_bin);
	glBindTexture(0, logotex);

	glBegin(GL_QUAD);
		glNormal(NORMAL_PACK(0,inttov10(1),0));

		glTexCoord1i(TEXTURE_PACK(0,0));
		glVertex3v16(floattov16(-0.5), floattov16(-0.5), floattov16(0.5) );
		
		glTexCoord1i(TEXTURE_PACK(inttot16(256), inttot16(0)));
		glVertex3v16(floattov16(0.5), floattov16(-0.5), floattov16(0.5) );

		glTexCoord1i(TEXTURE_PACK(inttot16(256),inttot16(256)));
		glVertex3v16(floattov16(0.5), floattov16(-0.5), floattov16(-0.5) );
		
		glTexCoord1i(TEXTURE_PACK(0, inttot16(256)));
		glVertex3v16(floattov16(-0.5),	floattov16(-0.5), floattov16(-0.5) );
	glEnd();
	
	glFlush(0);
	
	playGenericSound(down_raw, down_raw_size);
	playGenericSound(up_raw, up_raw_size);
	
	swiWaitForVBlank();
	
	iprintf("Press any button");
	
	while( !keysHeld() )
		scanKeys();
		
	glResetTextures();
	iprintf("\x1b[2J");
}
Пример #7
0
void gameLoop(){
	iprintf("\x1b[2J");
	int frame = 0;
	Board b(7);
	Player* p;
	p = new Player(b.space(5,4));
	
	//iprintf("Entering Main Loop.\n");

	int rot = 0;
	while( !b.full() )		
	{
		iprintf("\x1b[22;18HFrame: %d\n\x1b[0;0H", ++frame);
		glResetMatrixStack();

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

		glLight(0, RGB15(31,31,31), 0,	floattov10(1.0)-1, 0);

		glMatrixMode(GL_TEXTURE);
		glLoadIdentity();
		
		glMatrixMode(GL_MODELVIEW);

		glMaterialf(GL_AMBIENT, RGB15(8,8,8));
		glMaterialf(GL_DIFFUSE, RGB15(31,31,31));
		glMaterialf(GL_SPECULAR, RGB15(31,31,31));
		glMaterialf(GL_EMISSION, RGB15(8,8,8));

		//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 );
		//glPolyFmt(POLY_ALPHA(15) | POLY_CULL_BACK | POLY_FORMAT_LIGHT0 );
		
		glRotateY(rot);

		glBindTexture(0, textureID);

		b.draw();

		glFlush(0);

		b.tick();
		Player::tickPlayers();

		scanKeys();
		u16 keys = keysHeld();

		p->setDir(NODIR);
		if((keys & KEY_UP)) p->setDir(NORTH);
		if((keys & KEY_DOWN)) p->setDir(SOUTH);
		if((keys & KEY_LEFT)) p->setDir(WEST);
		if((keys & KEY_RIGHT)) p->setDir(EAST);


		if (( keys & KEY_R )) rot++;
		if (( keys & KEY_L )) rot--;
		
		swiWaitForVBlank();
	}
	lose(&b);
}
Пример #8
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 
Пример #9
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 
Пример #10
0
void TunnelPartInit(void)
{
	T_Mesh* mesh;
	int i;
	
	/* 
	 * Initialisation vidéo
	 */ 
	/* Modes video */
	videoSetMode(MODE_5_3D);
	videoSetModeSub(MODE_5_2D);
	lcdMainOnBottom();
	
	vramSetBankA(VRAM_A_MAIN_BG_0x06000000);
	vramSetBankB(VRAM_B_MAIN_BG_0x06020000);
	vramSetBankC(VRAM_C_SUB_BG_0x06200000);
	vramSetBankD(VRAM_D_TEXTURE_SLOT3);
	
	videoBgEnable(DISPLAY_BG0_ACTIVE | DISPLAY_BG2_ACTIVE);
	videoBgEnableSub(DISPLAY_BG2_ACTIVE | DISPLAY_BG3_ACTIVE);
	
	/* Le BG qui servira pour le tunnel */
	TunnelBgId = bgInitSub(2, BgType_Bmp16, BgSize_B16_256x256, 0, 0);
	TunnelBgPixels = (u16*)bgGetGfxPtr(TunnelBgId);
	bgSetPriority(TunnelBgId, 2); /* Le tunnel en fond */

	/* L'avant plan de l'éléphant */	
	FrontLayerId = bgInit(2, BgType_Bmp8, BgSize_B8_256x256, 8, 0);
	FrontLayerPixels = (u8*)bgGetGfxPtr(FrontLayerId);
	bgSetPriority(FrontLayerId, 0); /* En avant plan */
	decompress(bouleBitmap, FrontLayerPixels, LZ77Vram);
	decompress(boulePal, BG_PALETTE, LZ77Vram); 
	
	bgSetPriority(0, 1); /* La 3D entre les deux */
	
	
	/* Initialisation de la 3D */
    Init3DEngine();
    
	TunnelFxInit(TunnelBgPixels);
	        
    mesh = CreateMesh();
    mesh->display_list = DiscoElephant_mesh;
    mesh->alpha = 31;
    mesh->texturing = TRUE;
    mesh->lighting = TRUE;
    DiscoElephant = CreateObj3D(mesh);
    Scene = CreateScene();
    AddObject(Scene, DiscoElephant);
    
    Scene->lights[0] = CreateLight(floattov10(0), floattov10(0), floattov10(-1), RGB15(16, 0, 01), TRUE);
    Scene->lights[1] = CreateLight(floattov10(0), floattov10(0), floattov10(-1), RGB15(0, 16, 0), TRUE);
    Scene->lights[2] = CreateLight(floattov10(0), floattov10(0), floattov10(-1), RGB15(0, 0, 16), TRUE);
    Scene->lights[3] = CreateLight(floattov10(0), floattov10(0), floattov10(-1), RGB15(16, 16, 0), TRUE);
    
    glClearColor(0, 0, 0, 0);
    
    flare_tex = CreateTextureFromMemory((u8*)flareBitmap, GL_RGBA, 0, 16, 64, TRUE, LZ77Vram);
    
    for(i=0; i<4; i++) {
    	flares[i] = malloc(sizeof(*flares[i]));
    }
    
    flares[0]->position[0] = 0;
    flares[0]->position[1] = 0;
    flares[0]->position[2] = floattof32(-1);
    flares[0]->poly_alpha = 16;
    flares[0]->color = RGB15(31, 0, 0);
    flares[0]->size = floattov16(0.15f);
    flares[0]->texture_id = flare_tex->id;
    flares[0]->poly_id = 5;
    
    flares[1]->position[0] = 0;
    flares[1]->position[1] = 0;
    flares[1]->position[2] = floattof32(-1);
    flares[1]->poly_alpha = 16;
    flares[1]->color = RGB15(0, 31, 0);
    flares[1]->size = floattov16(0.15f);
    flares[1]->texture_id = flare_tex->id;
    flares[1]->poly_id = 6;
    
    flares[2]->position[0] = 0;
    flares[2]->position[1] = 0;
    flares[2]->position[2] = floattof32(-1);
    flares[2]->poly_alpha = 16;
    flares[2]->color = RGB15(0, 0, 31);
    flares[2]->size = floattov16(0.15f);
    flares[2]->texture_id = flare_tex->id;
    flares[2]->poly_id = 6;
    
    flares[3]->position[0] = 0;
    flares[3]->position[1] = 0;
    flares[3]->position[2] = floattof32(-1);
    flares[3]->poly_alpha = 16;
    flares[3]->color = RGB15(31, 31, 0);
    flares[3]->size = floattov16(0.15f);
    flares[3]->texture_id = flare_tex->id;
    flares[3]->poly_id = 7;
    
    tex = CreateTextureFromMemory((u8*)DiscoElephantBitmap, GL_RGB, 0, 16, 64, TRUE, LZ77Vram);
    DiscoElephant->mesh->texture_id = tex->id;
    DiscoElephant->mesh->texturing = TRUE;
    
	/* Initialisation du fade in depuis le blanc */
	REG_MASTER_BRIGHT = (1<<14);
	REG_MASTER_BRIGHT_SUB = REG_MASTER_BRIGHT;
	
	StartFlash(-1000); // pour éviter un flash à la première seconde
	
	glMaterialf(GL_AMBIENT, RGB15(16,16,16));
    glMaterialf(GL_SPECULAR, BIT(15) | RGB15(31,31,31));
	glMaterialShinyness();
}