void nextBoxHasColor(int *x, int *y, HasColorMode mode)
{
	VertexColor *sendVertices = mode & HASCOLOR_RGBA_TRANSPARENT ? transparentColorVertices : colorVertices;

	sendVertices[0].x = *x;
	sendVertices[0].y = *y;
	sendVertices[1].x = *x + 40;
	sendVertices[1].y = *y + 20;
	*x += 47;
	if (*x >= 470) {
		*x = 10;
		*y += 26;
	}
	sceKernelDcacheWritebackRange(sendVertices, sizeof(colorVertices));

	sceGuEnable(GU_TEXTURE_2D);
	sceGuTexMode(GU_PSM_T8, 0, 0, GU_FALSE);
	sceGuTexFunc(GU_TFX_DECAL, mode & HASCOLOR_RGB ? GU_TCC_RGB : GU_TCC_RGBA);
	sceGuTexImage(0, 4, 4, 16, imageData);

	sceGuDrawArray(GU_SPRITES, GU_COLOR_8888 | GU_TEXTURE_16BIT | GU_VERTEX_16BIT | GU_TRANSFORM_2D, 2, NULL, sendVertices);
	sceGuFinish();
	sceGuSync(GU_SYNC_LIST, GU_SYNC_WHAT_DONE);
	sceGuSync(0, 0);
	sceGuStart(GU_DIRECT, list);
}
Beispiel #2
0
extern "C" int main(int argc, char *argv[]) {
	init();

	checkpointNext("Nearest, clamp:");

	sceGuStart(GU_DIRECT, list);
	sceGuTexFilter(GU_NEAREST, GU_NEAREST);
	sceGuTexWrap(GU_CLAMP, GU_CLAMP);
	sceGuFinish();
	sceGuSync(0, 0);

	drawInterTransfer();

	checkpointNext("Linear, clamp:");

	sceGuStart(GU_DIRECT, list);
	sceGuTexFilter(GU_LINEAR, GU_LINEAR);
	sceGuTexWrap(GU_CLAMP, GU_CLAMP);
	sceGuFinish();
	sceGuSync(0, 0);

	drawInterTransfer();

	checkpointNext("Nearest, wrap:");

	sceGuStart(GU_DIRECT, list);
	sceGuTexFilter(GU_NEAREST, GU_NEAREST);
	sceGuTexWrap(GU_REPEAT, GU_REPEAT);
	sceGuFinish();
	sceGuSync(0, 0);

	drawInterTransfer();

	checkpointNext("Linear, wrap:");

	sceGuStart(GU_DIRECT, list);
	sceGuTexFilter(GU_LINEAR, GU_LINEAR);
	sceGuTexWrap(GU_REPEAT, GU_REPEAT);
	sceGuFinish();
	sceGuSync(0, 0);

	drawInterTransfer();

	drawIntraTransfer();
	drawUploadTransfer();
	sceGuTerm();

	return 0;
}
Beispiel #3
0
void drawUploadTransfer() {
	sceDisplaySetMode(0, SCR_WIDTH, SCR_HEIGHT);

	sceGuStart(GU_DIRECT, list);
	sceGuTexFilter(GU_LINEAR, GU_LINEAR);
	sceGuFinish();
	sceGuSync(0, 0);

	// This time, we only need one buffer.
	switchBuf(0, GU_PSM_8888);
	drawTexFlush(2, 2, 16, GU_PSM_T8, imageData, clutAddOne, vertices1);

	sceDisplayWaitVblank();

	// Okay, let's draw a totally different pattern in memory.
	for (int y = 0; y < 272; ++y) {
		for (int x = 0; x < 512; ++x) {
			copybuf[y * 512 + x] = (x & 1) + (y & 1);
		}
	}
	sceKernelDcacheWritebackInvalidateAll();
	sceDmacMemcpy(getBufAddr(0), copybuf, sizeof(copybuf));
	sceKernelDcacheWritebackInvalidateAll();

	// Now download should display out pattern.
	displayBuffer("Pattern");
}
Beispiel #4
0
void _gInit()
{
  // Init & setup GU
  sceGuInit();
  sceGuStart(GU_DIRECT,list);

  sceGuDrawBuffer(GU_PSM_8888,(void*)FRAMEBUFFER_SIZE,PSP_LINE_SIZE);
  sceGuDispBuffer(G_SCR_W,G_SCR_H,(void*)0,PSP_LINE_SIZE);
  sceGuDepthBuffer((void*)(FRAMEBUFFER_SIZE*2),PSP_LINE_SIZE);
  sceGuOffset(2048-(G_SCR_W/2),2048-(G_SCR_H/2));
  sceGuViewport(2048,2048,G_SCR_W,G_SCR_H);

  gResetScissor();
  sceGuDepthRange(65535,0);
  sceGuClearDepth(65535);
  sceGuAlphaFunc(GU_GREATER,0,0xff);
  sceGuDepthFunc(GU_LEQUAL);
  sceGuBlendFunc(GU_ADD,GU_SRC_ALPHA,GU_ONE_MINUS_SRC_ALPHA,0,0);
  sceGuTexFunc(GU_TFX_MODULATE,GU_TCC_RGBA);
  sceGuTexFilter(GU_LINEAR,GU_LINEAR);
  sceGuShadeModel(GU_FLAT);

  sceGuDisable(GU_CULL_FACE);
  sceGuDisable(GU_CLIP_PLANES);
  sceGuDisable(GU_DITHER);
  sceGuEnable(GU_ALPHA_TEST);
  sceGuEnable(GU_SCISSOR_TEST);

  sceGuFinish();
  sceGuSync(0,0);
  sceDisplayWaitVblankStart();
  sceGuDisplay(GU_TRUE);

  init = G_TRUE;
}
Beispiel #5
0
void MasterGuRenderer::guInit() {
	DEBUG_ENTER_FUNC();

	sceGuInit();
	sceGuStart(0, _displayList);

	guProgramDisplayBufferSizes();

	sceGuOffset(2048 - (PSP_SCREEN_WIDTH / 2), 2048 - (PSP_SCREEN_HEIGHT / 2));
	sceGuViewport(2048, 2048, PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT);
	sceGuDepthRange(0xC350, 0x2710);
	sceGuDisable(GU_DEPTH_TEST);	// We'll use depth buffer area
	sceGuDepthMask(GU_TRUE);		// Prevent writes to depth buffer
	sceGuScissor(0, 0, PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT);
	sceGuEnable(GU_SCISSOR_TEST);
	sceGuFrontFace(GU_CW);
	sceGuEnable(GU_TEXTURE_2D);

	sceGuClear(GU_COLOR_BUFFER_BIT | GU_DEPTH_BUFFER_BIT);
	sceGuFinish();
	sceGuSync(0, 0);

	sceDisplayWaitVblankStart();
	sceGuDisplay(1);
}
Beispiel #6
0
void vidgu_init()
{

	g_pBlitBuff = (unsigned short *)(0x40000000 | (unsigned int)&g_BlitBuff);

	sceGuInit();

	// setup
	sceGuStart(GU_DIRECT,list);
	sceGuDrawBuffer(GU_PSM_5650,(void*)0,512);
	sceGuDispBuffer(480,272,(void*)0x88000,512);
	sceGuDepthBuffer((void*)0x110000,512);
	sceGuOffset(2048 - (480/2),2048 - (272/2));
	sceGuViewport(2048,2048,480,272);
	sceGuDepthRange(0xc350,0x2710);
	sceGuScissor(0,0,480,272);
	sceGuEnable(GU_SCISSOR_TEST);
	sceGuFrontFace(GU_CW);
	sceGuEnable(GU_TEXTURE_2D);
	sceGuClear(GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT);
	sceGuFinish();
	sceGuSync(0,0);

	sceDisplayWaitVblankStart();
	sceGuDisplay(1);

}
Beispiel #7
0
void psp_init(void)
{
	SceUID thid;
	char buff[128], *r;

	/* fw 1.5 sometimes returns 8002032c, although getcwd works */
	r = getcwd(buff, sizeof(buff));
	if (r) sceIoChdir(buff);

	main_thread_id = sceKernelGetThreadId();

	lprintf("running on %08x kernel\n", sceKernelDevkitVersion()),
	lprintf("entered psp_init, threadId %08x, priority %i\n", main_thread_id,
		sceKernelGetThreadCurrentPriority());

	thid = sceKernelCreateThread("update_thread", callback_thread, 0x11, 0xFA0, 0, NULL);
	if (thid >= 0)
	{
		sceKernelStartThread(thid, 0, 0);
	}

	/* video */
	sceDisplaySetMode(0, 480, 272);
	sceDisplaySetFrameBuf(VRAM_FB1, 512, PSP_DISPLAY_PIXEL_FORMAT_565, PSP_DISPLAY_SETBUF_NEXTFRAME);
	current_screen = 1;
	psp_screen = VRAM_FB0;

	/* gu */
	sceGuInit();

	sceGuStart(GU_DIRECT, guCmdList);
	sceGuDrawBuffer(GU_PSM_5650, (void *)VRAMOFFS_FB0, 512);
	sceGuDispBuffer(480, 272, (void *)VRAMOFFS_FB1, 512); // don't care
	sceGuClear(GU_COLOR_BUFFER_BIT | GU_DEPTH_BUFFER_BIT);
	sceGuDepthBuffer((void *)VRAMOFFS_DEPTH, 512);
	sceGuOffset(2048 - (480 / 2), 2048 - (272 / 2));
	sceGuViewport(2048, 2048, 480, 272);
	sceGuDepthRange(0xc350, 0x2710);
	sceGuScissor(0, 0, 480, 272);
	sceGuEnable(GU_SCISSOR_TEST);

	sceGuDepthMask(0xffff);
	sceGuDisable(GU_DEPTH_TEST);

	sceGuFrontFace(GU_CW);
	sceGuEnable(GU_TEXTURE_2D);
	sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGB);
	sceGuAmbientColor(0xffffffff);
	sceGuColor(0xffffffff);
	sceGuFinish();
	sceGuSync(0, 0);

	sceDisplayWaitVblankStart();
	sceGuDisplay(GU_TRUE);


	/* input */
	sceCtrlSetSamplingCycle(0);
	sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
}
Beispiel #8
0
void setupGu(void)
{
	sceGuInit();

	sceGuStart(GU_DIRECT, list);
	sceGuDrawBuffer(GU_PSM_8888, 0, BUF_WIDTH);
	sceGuDispBuffer(SCR_WIDTH, SCR_HEIGHT, (void*)0x88000, BUF_WIDTH);
	sceGuDepthBuffer((void*)0x110000, BUF_WIDTH);

	sceGuOffset(0, 0);

	sceGuScissor(0, 0, SCR_WIDTH, SCR_HEIGHT);
	sceGuEnable(GU_SCISSOR_TEST);

	sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_ONE_MINUS_SRC_ALPHA, 0, 0);
	sceGuEnable(GU_BLEND);

	//sceGuTexFunc(GU_TFX_MODULATE, GU_TCC_RGBA);
	//sceGuTexFilter(GU_LINEAR_MIPMAP_LINEAR, GU_NEAREST);
	//sceGuTexWrap(GU_REPEAT, GU_REPEAT);

	sceGuClearColor(0);
	sceGuClearDepth(0);
	sceGuClearStencil(0);

	sceGuFinish();
	sceGuSync(0, 0);
	
	sceDisplayWaitVblankStart();
	sceGuDisplay(GU_TRUE);
}
Beispiel #9
0
void vidgu_render_nostretch(int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh)
{
	int start, end;

	sceGuStart(GU_DIRECT,list);
	sceGuTexMode(GU_PSM_5650,0,0,0); // 16-bit RGBA
	sceGuTexImage(0,512,512,512,g_pBlitBuff); // setup texture as a 256x256 texture
	//sceKernelDcacheWritebackAll();
	sceGuTexFunc(GU_TFX_REPLACE,GU_TCC_RGBA); // don't get influenced by any vertex colors
	sceGuTexFilter(GU_NEAREST,GU_NEAREST); // point-filtered sampling
	for (start = sx, end = sx+sw; start < end; start += SLICE_SIZE, dx += SLICE_SIZE)
	{
		struct Vertex* vertices = (struct Vertex*)sceGuGetMemory(2 * sizeof(struct Vertex));
		int width = (start + SLICE_SIZE) < end ? SLICE_SIZE : end-start;

		vertices[0].u = start; vertices[0].v = sy;
		vertices[0].color = 0;
		vertices[0].x = dx; vertices[0].y = dy; vertices[0].z = 0;

		vertices[1].u = start + width; vertices[1].v = sy + sh;
		vertices[1].color = 0;
		vertices[1].x = dx + width; vertices[1].y = dy + sh; vertices[1].z = 0;

		sceGuDrawArray(GU_SPRITES,GU_TEXTURE_16BIT|GU_COLOR_5650|GU_VERTEX_16BIT|GU_TRANSFORM_2D,2,0,vertices);
	}
	sceGuFinish();
	sceGuSync(0,0);
	sceDisplayWaitVblankStart();
	sceGuSwapBuffers();
	//sceGuSwapBuffers();
}
Beispiel #10
0
void draw()
{
	sceGuStart(GU_DIRECT, list);
	sceGuClear(GU_COLOR_BUFFER_BIT|GU_STENCIL_BUFFER_BIT|GU_DEPTH_BUFFER_BIT);
	sceGuFinish();
	sceGuSync(0, 0);	
}
void StopRendering()
{
	sceGumLoadIdentity();
	sceGuFinish();
	sceGuSync(SCEGU_SYNC_FINISH, SCEGU_SYNC_WAIT);
	//printf("FrontEnd::StopRendering\n");
}
Beispiel #12
0
void psp_init() {
	SetupCallbacks();

	sceGuInit();

	//sceGuStart(GU_DIRECT,list);
	//sceGuDrawBuffer(GU_PSM_5650,(void*)0,512);
	//sceGuDispBuffer(SCR_WIDTH,SCR_HEIGHT,(void*)0x44000,512);
	//sceGuViewport(0,0,SCR_WIDTH,SCR_HEIGHT);
	//sceGuScissor(0,0,SCR_WIDTH,SCR_HEIGHT);
	//sceGuEnable(GU_SCISSOR_TEST);
	//sceGuFrontFace(GU_CW);
	//sceGuShadeModel(GU_SMOOTH);
	//sceGuEnable(GU_CULL_FACE);
	//sceGuEnable(GU_TEXTURE_2D);
	//sceGuFinish();
	//sceGuSync(0,0);
	//sceGuDisplay(GU_TRUE);


	sceGuStart(GU_DIRECT,list);
	sceGuDrawBuffer(GU_PSM_5650,(void*)0,512);
	sceGuDispBuffer(SCR_WIDTH,SCR_HEIGHT,(void*)0x44000,512);
	//sceGuViewport(0,0,SCR_WIDTH,SCR_HEIGHT);
	//sceGuScissor(0,0,SCR_WIDTH,SCR_HEIGHT);
	//sceGuEnable(GU_SCISSOR_TEST);
	//sceGuFrontFace(GU_CW);
	//sceGuShadeModel(GU_SMOOTH);
	//sceGuEnable(GU_CULL_FACE);
	//sceGuEnable(GU_TEXTURE_2D);
	sceGuFinish();
	sceGuSync(0,0);
	sceGuDisplay(GU_TRUE);

}
Beispiel #13
0
void testBlendFunc(const char *title, u32 prev, u32 c, int op, int src, int dst, u32 fixa, u32 fixb) {
	for (size_t i = 0; i < sizeof(copybuf) / 4; ++i) {
		copybuf[i] = prev;
	}
	sceKernelDcacheWritebackInvalidateAll();
	sceDmacMemcpy(sceGeEdramGetAddr(), copybuf, sizeof(copybuf));
	sceKernelDcacheWritebackInvalidateAll();

	sceGuStart(GU_DIRECT, list);

	sceGuEnable(GU_BLEND);
	sceGuBlendFunc(op, src, dst, fixa, fixb);

	sceGuEnable(GU_STENCIL_TEST);
	sceGuStencilFunc(GU_ALWAYS, 0xAA, 0xFF);
	sceGuStencilOp(GU_REPLACE, GU_REPLACE, GU_REPLACE);

	drawBoxCommands(c);

	sceGuFinish();
	sceGuSync(GU_SYNC_WAIT, GU_SYNC_WHAT_DONE);

	displayBuffer(title);

	sceGuDisable(GU_BLEND);
}
Beispiel #14
0
void Red3dFlipGuBuffer()
{
	sceGuFinish();
	sceGuSync(0,0);
	sceDisplayWaitVblankStart();
	framebuffer = sceGuSwapBuffers();
	dispBufferNumber ^= 1;
	Red3dSetupScreen();
}
Beispiel #15
0
void MFRenderer_EndFramePlatformSpecific()
{
	MFCALLSTACK;

	sceGuFinish();
	sceGuSync(0, 0);

	sceDisplayWaitVblankStart();
	sceGuSwapBuffers();
}
Beispiel #16
0
void switchBuf(int i, int fmt) {
	int off = (i * 512 * 272 * 4);
	void *p = (void *)off;
	drawbuf = (u32 *)getBufAddr(i);

	sceGuStart(GU_DIRECT, list);
	sceGuDrawBuffer(fmt, p, BUF_WIDTH);
	sceGuDispBuffer(SCR_WIDTH, SCR_HEIGHT, p, BUF_WIDTH);
	sceGuFinish();
	sceGuSync(0, 0);
}
Beispiel #17
0
void gFlip(bool use_vsync)
{
  if (scissor) gResetScissor();

  sceGuFinish();
  sceGuSync(0,0);
  if (use_vsync) sceDisplayWaitVblankStart();
  sceGuSwapBuffers();

  start = G_FALSE;
}
Beispiel #18
0
// This callback is called when the render is finished. It swaps the buffers
int MasterGuRenderer::guCallback(int, int, void *__this) {

	MasterGuRenderer *_this = (MasterGuRenderer *)__this;

	sceGuSync(0, 0);				// make sure we wait for GU to finish
	sceDisplayWaitVblankStartCB();	// wait for v-blank without eating main thread cycles
	sceGuSwapBuffers();				// swap the back and front buffers

	_this->_renderFinished = true;	// Only this thread can set the variable to true

	_this->_renderSema.give(); 		// Release render semaphore
	return 0;
}
Beispiel #19
0
void vidgu_render(int sx, int sy, int sw,int sh,int dx, int dy, int dw,int dh)
{
	unsigned int j,cx,cy;
	struct Vertex* vertices;

	cx=(480-dw)/2;
	cy=(272-dh)/2;

	sceGuStart(GU_DIRECT,list);
	sceGuTexMode(GU_PSM_5650,0,0,0); // 16-bit RGBA
	sceGuTexImage(0,512,512,512,g_pBlitBuff); // setup texture as a 256x256 texture
	//sceKernelDcacheWritebackAll();
	sceGuTexFunc(GU_TFX_REPLACE,GU_TCC_RGBA); // don't get influenced by any vertex colors
	sceGuTexFilter(GU_LINEAR,GU_LINEAR); // point-filtered sampling

	int		start, end;
	float	ustart = (float)sx;
	float	ustep = (float)sw / (float)(dw / SLICE_SIZE);

	// blit maximizing the use of the texture-cache

	for (start = sx, end = sx+dw; start < end; start += SLICE_SIZE, dx += SLICE_SIZE)
	{
		struct Vertex* vertices = (struct Vertex*)sceGuGetMemory(2 * sizeof(struct Vertex));
		int width = (start + SLICE_SIZE) < end ? SLICE_SIZE : end-start;

		vertices[0].u = ustart; 
		vertices[0].v = (float)sy;
		vertices[0].color = 0;
		vertices[0].x = dx; 
		vertices[0].y = dy; 
		vertices[0].z = 0;

		vertices[1].u = ustart + ustep; 
		vertices[1].v = (float)(sy + sh);
		vertices[1].color = 0;
		vertices[1].x = dx + width; 
		vertices[1].y = dy + dh; 
		vertices[1].z = 0;

		sceGuDrawArray(GU_SPRITES,GU_TEXTURE_16BIT|GU_COLOR_5650|GU_VERTEX_16BIT|GU_TRANSFORM_2D,2,0,vertices);

		ustart += ustep;
	}


	sceGuFinish();
	sceGuSync(0,0);
	sceDisplayWaitVblankStart();
	sceGuSwapBuffers(); 
}
Beispiel #20
0
void oslDrawDialog()
{
    if (dialogType == OSL_DIALOG_MESSAGE || dialogType == OSL_DIALOG_ERROR){
        switch(sceUtilityMsgDialogGetStatus()) {
			case PSP_UTILITY_DIALOG_INIT:
            case PSP_UTILITY_DIALOG_VISIBLE:
				sceGuFinish();
				sceGuSync(0,0);
				sceUtilityMsgDialogUpdate(1);
				sceGuStart(GU_DIRECT, osl_list);
				oslSetAlpha(OSL_FX_RGBA, 0xff);
				break;
            case PSP_UTILITY_DIALOG_QUIT:
                sceUtilityMsgDialogShutdownStart();
                break;
            case PSP_UTILITY_DIALOG_NONE:
                break;
        }
    }else if (dialogType == OSL_DIALOG_NETCONF){
        switch(sceUtilityNetconfGetStatus()){
			case PSP_UTILITY_DIALOG_INIT:
            case PSP_UTILITY_DIALOG_VISIBLE:
				sceGuFinish();
				sceGuSync(0,0);
				sceUtilityNetconfUpdate(1);
				sceGuStart(GU_DIRECT, osl_list);
				oslSetAlpha(OSL_FX_RGBA, 0xff);
                break;
            case PSP_UTILITY_DIALOG_QUIT:
                sceUtilityNetconfShutdownStart();
                break;
            case PSP_UTILITY_DIALOG_NONE:
            case PSP_UTILITY_DIALOG_FINISHED:
                break;
		}
    }
}
/**
  * Created 24/02/2011
  * Finishes rendering
  */
void FrontEnd::StopRendering(void)
{
#ifdef PC
	_pd3dDevice->EndScene();
	_pd3dDevice->Present( NULL, NULL, NULL, NULL );
#else
	sceGumLoadIdentity();
	sceGuFinish();
	sceGuSync(SCEGU_SYNC_FINISH, SCEGU_SYNC_WAIT);
	sceGuDebugFlush();
	sceDisplayWaitVblankStart();
	//sceGumPopMatrix();
	//printf("FrontEnd::StopRendering\n");
#endif
}
//**********************************************************************************
//	
//**********************************************************************************
void	CTexture::Upload()
{
//	Swizzle();

	sceGuStart( GU_DIRECT, CGfx::GetDrawList() );

	sceGuCopyImage( GU_PSM_8888, 0, 0, m_nWidth, m_nHeight, m_nCanvasWidth, m_pBuffer, 0, 0, m_nCanvasWidth, s_pVRAM );

	sceGuFinish();
	sceGuSync( 0, 0 );

	m_pVRAM = s_pVRAM;

	s_pVRAM += m_nCanvasWidth * m_nHeight * 4;
}
Beispiel #23
0
void drawTexFlush(int width, int height, int stride, int texfmt, const void *tex, const void *clut, int clutfmt, int blocks, const void *verts, int indexMask) {
	sceGuStart(GU_DIRECT, list);

	sceGuEnable(GU_TEXTURE_2D);
	sceGuTexMode(texfmt, 0, 0, GU_FALSE);
	sceGuTexFunc(GU_TFX_DECAL, GU_TCC_RGB);
	sceGuTexImage(0, width, height, stride, tex);

	sceGuClutLoad(blocks, clut);
	sceGuClutMode(clutfmt, 0, indexMask, 0);
	sceGuDrawArray(GU_SPRITES, GU_TEXTURE_16BIT | GU_VERTEX_16BIT | GU_TRANSFORM_2D, 2, NULL, verts);

	sceGuFinish();
	sceGuSync(0, 0);
}
Beispiel #24
0
void drawWithIndexOffsets() {
	sceDisplaySetMode(0, SCR_WIDTH, SCR_HEIGHT);

	sceGuStart(GU_DIRECT, list);
	sceGuTexFilter(GU_NEAREST, GU_NEAREST);
	sceGuFinish();
	sceGuSync(0, 0);

	checkpointNext("Index shifts 8888:");
	drawWithIndexOffsetsFmt(GU_PSM_8888);
	schedf("\n");

	checkpointNext("Index shifts 4444:");
	drawWithIndexOffsetsFmt(GU_PSM_4444);
}
Beispiel #25
0
void nextBox(int *x, int *y)
{
	vertices[0].x = *x;
	vertices[0].y = *y;
	vertices[1].x = *x + 40;
	vertices[1].y = *y + 20;
	*x += 47;
	if (*x >= 470) {
		*x = 10;
		*y += 26;
	}
	sceKernelDcacheWritebackRange(vertices, sizeof(vertices));

	sceGuEnable(GU_TEXTURE_2D);
	sceGuTexMode(GU_PSM_T8, 0, 0, GU_FALSE);
	sceGuTexFunc(GU_TFX_DECAL, GU_TCC_RGBA);
	sceGuTexImage(0, 4, 4, 16, imageData);

	sceGuDrawArray(GU_SPRITES, GU_TEXTURE_16BIT | GU_VERTEX_16BIT | GU_TRANSFORM_2D, 2, NULL, vertices);
	sceGuFinish();
	sceGuSync(GU_SYNC_LIST, GU_SYNC_WHAT_DONE);
	sceGuSync(0, 0);
	sceGuStart(GU_DIRECT, list);
}
Beispiel #26
0
void
psp_sdl_gu_init(void)
{
	sceGuStart(GU_DIRECT,list);
	sceGuEnable(GU_TEXTURE_2D);
	sceGuTexMode(GU_PSM_5650, 0, 0, GU_FALSE);
	sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGB);
	sceGuTexFilter(GU_LINEAR, GU_LINEAR);
	sceGuDisable(GU_BLEND);
  sceGuDisable(GU_DEPTH_TEST);
	sceGuFinish();
	sceGuSync(0, 0);

  sceDisplayWaitVblankStart();
}
Beispiel #27
0
void DrawScene( void )
{
	sceGuStart( GU_DIRECT, sceneList );

	sceGuViewport( 2048, 2048, SCR_WIDTH, SCR_HEIGHT);	

	sceGuClear(GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT);
	sceGumMatrixMode(GU_MODEL);		
	sceGumLoadIdentity();	// Reset the Matrix

	myScene->render();	// Render the scene
	
	sceGuFinish();
	sceGuSync(0,0);
}
Beispiel #28
0
void DrawScene( void )
{
#warning Try taking out this display list at some point
	sceGuStart( GU_DIRECT, sceneList );

	sceGuViewport( 2048, 2048, SCR_WIDTH, SCR_HEIGHT);	

	sceGuClear(GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT);
	sceGumMatrixMode(GU_MODEL);		
	sceGumLoadIdentity();	// Reset the Matrix

	myScene.render();	// Render the scene
	
	sceGuFinish();
	sceGuSync(0,0);
}
Beispiel #29
0
void init()
{
	void *fbp0 = 0;
 
	sceGuInit();
	sceGuStart(GU_DIRECT, list);
	sceGuDrawBuffer(GU_PSM_8888, fbp0, BUF_WIDTH);
	sceGuDispBuffer(SCR_WIDTH, SCR_HEIGHT, fbp0, BUF_WIDTH);
	sceGuScissor(0, 0, SCR_WIDTH, SCR_HEIGHT);
	sceGuEnable(GU_SCISSOR_TEST);
	sceGuFinish();
	sceGuSync(0, 0);
 
	sceDisplayWaitVblankStart();
	sceGuDisplay(1);
}
Beispiel #30
0
void Red3dInitScreen()
{
	
	intraFontInit();
    
	ltn = intraFontLoad("flash0:/font/ltn8.pgf", 0);
	if(!ltn) sceKernelExitGame();
	intraFontSetStyle(ltn, 1.0f, 0xFFFFFFFF, 0xBFBFBFBF, 0);
	
	void *fbp0 = vrelptr(valloc((FRAMEBUFFER_WIDTH * sizeof(unsigned int))   * SCREEN_HEIGHT));
	void *fbp1 = vrelptr(valloc((FRAMEBUFFER_WIDTH * sizeof(unsigned int))   * SCREEN_HEIGHT));
	void *zbp  = vrelptr(valloc((FRAMEBUFFER_WIDTH * sizeof(unsigned short)) * SCREEN_HEIGHT));
	
	pspDebugScreenInit();
	sceGuInit();
	sceGuStart(GU_DIRECT,list);

	sceGuDrawBuffer(GU_PSM_8888, fbp0, FRAMEBUFFER_WIDTH);
	sceGuDispBuffer(SCREEN_WIDTH, SCREEN_HEIGHT, fbp1, FRAMEBUFFER_WIDTH);
	sceGuDepthBuffer(zbp, FRAMEBUFFER_WIDTH);
	sceGuOffset(2048 - (SCREEN_WIDTH/2),2048 - (SCREEN_HEIGHT/2));
	sceGuViewport(2048, 2048, SCREEN_WIDTH, SCREEN_HEIGHT);
	sceGuDepthRange(65535, 0);
    sceGuScissor(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
    
    sceGuDepthFunc(GU_GEQUAL);
    sceGuEnable(GU_DEPTH_TEST);
	sceGuEnable(GU_SCISSOR_TEST);
	
	sceGuFrontFace(GU_CCW);
	sceGuShadeModel(GU_SMOOTH);
	sceGuEnable(GU_CULL_FACE);
	sceGuEnable(GU_CLIP_PLANES);
	
	sceGuEnable(GU_BLEND);
	sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_ONE_MINUS_SRC_ALPHA, 0, 0);
	
	sceGuEnable(GU_TEXTURE_2D);
	sceGuTexFunc(GU_TFX_ADD,GU_TCC_RGBA);
	sceGuTexFilter(GU_LINEAR,GU_LINEAR);
	
	sceGuFinish();
	sceGuSync(0,0);
	
	Red3dSetupScreen();
	
}