예제 #1
0
파일: 3ds_glimp.c 프로젝트: elhobbs/quake3
void		GLimp_EndFrame( void ) {
	gpuFrameEnd();
	ctr_rend_buffer_reset();
	printf("--------end frame -------\n\n");

	gpuClearBuffers(CLEAR_COLOR);

	gpuFrameBegin();
}
예제 #2
0
파일: main.c 프로젝트: Chibiyima/ctrulib
int main()
{
	// Initialize graphics
	gfxInitDefault();
	gpuInit();

	// Initialize the scene
	sceneInit();
	gpuClearBuffers(CLEAR_COLOR);

	// Main loop
	while (aptMainLoop())
	{
		gspWaitForVBlank();  // Synchronize with the start of VBlank
		gfxSwapBuffersGpu(); // Swap the framebuffers so that the frame that we rendered last frame is now visible
		hidScanInput();      // Read the user input

		// Respond to user input
		u32 kDown = hidKeysDown();
		if (kDown & KEY_START)
			break; // break in order to return to hbmenu

		// Render the scene
		gpuFrameBegin();
		sceneRender();
		gpuFrameEnd();
		gpuClearBuffers(CLEAR_COLOR);

		// Flush the framebuffers out of the data cache (not necessary with pure GPU rendering)
		//gfxFlushBuffers();
	}

	// Deinitialize the scene
	sceneExit();

	// Deinitialize graphics
	gpuExit();
	gfxExit();
	return 0;
}
예제 #3
0
파일: 3ds_glimp.c 프로젝트: elhobbs/quake3
void 		GLimp_Init( void )
{
	gpuInit();
	glConfig.vidWidth = 400;
	glConfig.vidHeight = 240;
	glConfig.colorBits = 32;
	glConfig.depthBits = 24;
	glConfig.deviceSupportsGamma = qfalse;
	glConfig.displayFrequency = 60;
	glConfig.windowAspect = 400.0f / 240.0f;
	glConfig.maxActiveTextures = 3;
	ri.Cvar_Set("r_picmip", "2");
	qglLockArraysEXT = glLockArraysEXT;
	qglUnlockArraysEXT = glUnlockArraysEXT;
	qglActiveTextureARB = glActiveTexture;
	qglClientActiveTextureARB = glClientActiveTexture;

	ctr_rend_init();
	// Bind the shader program
	glUseProgram(0);

	gpuClearBuffers(CLEAR_COLOR);

	gpuFrameBegin();

	// Configure the first fragment shading substage to blend the texture color with
	// the vertex color (calculated by the vertex shader using a lighting algorithm)
	// See https://www.opengl.org/sdk/docs/man2/xhtml/glTexEnv.xml for more insight
	GPU_SetTexEnv(0,
		GPU_TEVSOURCES(GPU_TEXTURE0, GPU_PRIMARY_COLOR, GPU_PRIMARY_COLOR), // RGB channels
		GPU_TEVSOURCES(GPU_TEXTURE0, GPU_PRIMARY_COLOR, GPU_PRIMARY_COLOR), // Alpha
		GPU_TEVOPERANDS(0, 0, 0), // RGB
		GPU_TEVOPERANDS(0, 0, 0), // Alpha
		GPU_MODULATE, GPU_MODULATE, // RGB, Alpha
		0xFFFFFFFF);
	GPU_SetDummyTexEnv(1);
	GPU_SetDummyTexEnv(2);
	GPU_SetDummyTexEnv(3);
	GPU_SetDummyTexEnv(4);
	GPU_SetDummyTexEnv(5);

	// Load the texture
	//glGenTextures(1, &g_tex_id);
	//glBindTexture(0, g_tex_id);
	//glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 64, 64, 0, GL_RGBA, GL_UNSIGNED_BYTE, kitten_bin);
}