Exemple #1
0
void PS3Graphics::InitDbgFont()
{
	CellDbgFontConfig cfg;
	memset(&cfg, 0, sizeof(cfg));
	cfg.bufSize = 512;
	cfg.screenWidth = gl_width;
	cfg.screenHeight = gl_height;
	cellDbgFontInit(&cfg);
}
Exemple #2
0
void CapApp::dbgFontInit(void)
{
// initialize debug font library, then open 2 consoles
int ret;

CellDbgFontConfig cfg;
memset(&cfg, 0, sizeof(CellDbgFontConfig));

cfg.bufSize = 2048;
cfg.screenWidth = mDispInfo.mWidth;
cfg.screenHeight = mDispInfo.mHeight;

ret = cellDbgFontInit(&cfg);

if (ret != CELL_OK)
{
cellMsgDialogOpen2(CELL_MSGDIALOG_DIALOG_TYPE_NORMAL, "cellDbgFontInit() failed", callbackfunction, NULL, NULL);
return;
}

CellDbgFontConsoleConfig ccfg[2];
memset(ccfg, 0, sizeof(ccfg));

ccfg[0].posLeft = 0.1f;
ccfg[0].posTop = 0.8f;
ccfg[0].cnsWidth = 32;
ccfg[0].cnsHeight = 4;
ccfg[0].scale = 1.0f;

// ABGR -> orange
ccfg[0].color = 0xff0080ff;

//mDbgFontID[0] = cellDbgFontConsoleOpen(&ccfg[0]);

if (mDbgFontID[0] < 0)
{
cellMsgDialogOpen2(CELL_MSGDIALOG_DIALOG_TYPE_NORMAL, "cellDbgFontConsoleOpen() failed", callbackfunction, NULL, NULL);
return;
}

ccfg[1].posLeft = 0.25f;
ccfg[1].posTop = 0.2f;
ccfg[1].cnsWidth = 256;
ccfg[1].cnsHeight = 64;
ccfg[1].scale = 0.5f;

// ABGR -> pale blue
ccfg[1].color = 0xffff8080;

if (mDbgFontID[1] < 0)
{
cellMsgDialogOpen2(CELL_MSGDIALOG_DIALOG_TYPE_NORMAL, "cellDbgFontConsoleOpen() failed", callbackfunction, NULL, NULL);
return;
}
}
Exemple #3
0
void CapApp::dbgFontInit()
{
	int ret;

	CellDbgFontConfig cfg;
	memset(&cfg, 0, sizeof(CellDbgFontConfig));
	
	cfg.bufSize      = 1024 * 10;
	cfg.screenWidth  = deviceWidth;
	cfg.screenHeight = deviceHeight;
	
	ret = cellDbgFontInit(&cfg);

	if (ret != CELL_OK) 
	{
		// error...
		return;
	}

}
Exemple #4
0
bool COLLADA_Viewer::onInit(int argc, char **ppArgv)
{
	FWGLApplication::onInit(argc, ppArgv);

    glClearColor(0.3f,0.3f,0.7f, 0.0f);
	glClearDepthf(1.0f);
	glEnable(GL_DEPTH_TEST);

	FWDebugFont::setColor(1.f, 1.f, 1.f, 1.f);  

	InitFS();
	Browser.Init();

	psglLoadShaderLibrary("/app_home/shaders.bin");

	// Initialize the renderer
	_CrtRender.Init();
	_CrtRender.SetUsingVBOs(CrtTrue);
	_CrtRender.SetShowHiearchy(CrtTrue);
	glEnable(GL_TEXTURE_2D);							
	glShadeModel(GL_SMOOTH);							
	glClearColor(0.0f, 0.0f, 1.0f, 0.5f);				
	glEnable(GL_DEPTH_TEST);
	glDepthFunc(GL_LEQUAL);
	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);	
	glEnable(GL_LIGHT0);
	glEnable(GL_LIGHTING);
	glEnable( GL_CULL_FACE );
	glCullFace( GL_BACK ); 

    cgRTCgcInit();
	ParseDir("/app_home/");

  // Load the target file
	Browser.onUpdate();
	if (argc > 0)
	{
		char path_name[1024];
		mCurrentFile = ppArgv[0];
		sprintf(path_name, "%s%s", "/app_home/", ppArgv[0]);
		printf(path_name);
		load_ok  = _CrtRender.Load(path_name, NULL);
		if ( !load_ok )
   			return false;  
	}
	else if (Browser.GetSize() > 0)
	{
		mCurrentFile = Browser.GetThumbnail(0)->GetDocument();
		load_ok  = _CrtRender.Load(mCurrentFile, NULL);
		if ( !load_ok )
   			return false;  
	}
	// Get the gamepad so we can read it later 
	mpPad = FWInput::getDevice(FWInput::DeviceType_Pad,0);
	if(mpPad==NULL)
	{
	  printf("Error, couldn't get a pad\n");
	  exit(0);
	}

	mpInputX0 = mpPad->bindFilter();
	mpInputX0->setChannel(FWInput::Channel_XAxis_0);
	mpInputX0->setGain( 1.0f );
	mpInputX0->setDeadzone( 0.3f );

	mpInputY0 = mpPad->bindFilter();
	mpInputY0->setChannel(FWInput::Channel_YAxis_0);
	mpInputY0->setGain( 1.0f );
	mpInputY0->setDeadzone( 0.3f );

	mpInputX1 = mpPad->bindFilter();
	mpInputX1->setChannel(FWInput::Channel_XAxis_1);
	mpInputX1->setGain( 1.0f );
	mpInputX1->setDeadzone( 0.3f );

	mpInputY1 = mpPad->bindFilter();
	mpInputY1->setChannel(FWInput::Channel_YAxis_1);
	mpInputY1->setGain( 1.0f );
	mpInputY1->setDeadzone( 0.3f );


  	// initialize debug font library, then open console.
	int ret;
	CellDbgFontConfig cfg;
	memset(&cfg, 0, sizeof(CellDbgFontConfig));
	cfg.bufSize      = 512;
	cfg.screenWidth  = mDispInfo.mWidth;
	cfg.screenHeight = mDispInfo.mHeight;
	ret = cellDbgFontInit(&cfg);
	if (ret != CELL_OK) {
		printf("cellDbgFontInit() failed %x\n", ret);
		return true;
	}

	CellDbgFontConsoleConfig ccfg;
	memset(&ccfg, 0, sizeof(CellDbgFontConsoleConfig));
	ccfg.posLeft     = 0.1f;
	ccfg.posTop      = 0.6f;
	ccfg.cnsWidth    = 16;
	ccfg.cnsHeight   = 4;
	ccfg.scale       = 1.5f;
	ccfg.color       = 0xffffffff;
	mDbgFontID       = cellDbgFontConsoleOpen(&ccfg);
	if (mDbgFontID < 0) {
		printf("cellDbgFontConsoleOpen() failed %x\n", mDbgFontID);
		return true;
	}

	return true;
}
//-----------------------------------------------------------------------------
// Purpose: Initialize the PSGL rendering interfaces and default state
//-----------------------------------------------------------------------------
bool CGameEnginePS3::BInitializePSGL()
{
	// Clear any errors
	glGetError();

	// First, initialize PSGL
	// Note that since we initialized the SPUs ourselves earlier we should
	// make sure that PSGL doesn't try to do so as well.
	PSGLinitOptions initOpts = {
		enable: PSGL_INIT_MAX_SPUS | PSGL_INIT_INITIALIZE_SPUS | PSGL_INIT_HOST_MEMORY_SIZE,
		maxSPUs: 1,
		initializeSPUs: false,
						// We're not specifying values for these options, the code is only here
						// to alleviate compiler warnings.
		persistentMemorySize: 0,
		transientMemorySize: 0,
		errorConsole: 0,
		fifoSize: 0,	
		hostMemorySize: 128*1024*1024,  // 128 mbs for host memory 
	};

	psglInit( &initOpts );

	m_pPSGLDevice = psglCreateDeviceAuto( GL_ARGB_SCE, GL_DEPTH_COMPONENT24, GL_MULTISAMPLING_4X_SQUARE_ROTATED_SCE );
	if ( !m_pPSGLDevice )
	{
		OutputDebugString( "!! Failed to init the device \n" ); 
		return false;
	}

	GLuint width, height;
	psglGetDeviceDimensions( m_pPSGLDevice, &width, &height );
	m_nWindowHeight = height;
	m_nWindowWidth = width;

	// Now create a PSGL context
	m_pPSGLContext = psglCreateContext();
	if ( !m_pPSGLContext ) 
	{
		OutputDebugString( "Error creating PSGL context\n" );
		return false;
	}

	// Make this context current for the device we initialized
	psglMakeCurrent( m_pPSGLContext, m_pPSGLDevice );

	// Since we're using fixed function stuff (i.e. not using our own shader
	// yet), we need to load shaders.bin that contains the fixed function 
	// shaders.
	psglLoadShaderLibrary( SYS_APP_HOME"/shaders.bin" );

	// Reset the context
	psglResetCurrentContext();

	glViewport( 0, 0, width, height );
	glScissor( 0, 0, width, height );
	glClearDepthf(1.0f);
	glClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
	glEnable( GL_VSYNC_SCE );

	glEnable( GL_BLEND );
	glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );

	glDisable( GL_CULL_FACE );
	glDisable( GL_ALPHA_TEST );
	glDisable( GL_STENCIL_TEST );
	glDisable( GL_SCISSOR_TEST );
	glDisable( GL_LIGHTING );
	glDisable( GL_DEPTH_TEST );
	glDisable( GL_FOG );

	glDepthMask( GL_FALSE );

	// We always need these two
	glEnableClientState( GL_COLOR_ARRAY );
	glEnableClientState( GL_VERTEX_ARRAY );

	// This we'll enable as needed
	glDisableClientState( GL_TEXTURE_COORD_ARRAY );

	glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );

	glMatrixMode( GL_PROJECTION );
	glLoadIdentity();
	glOrthof( 0, width, height, 0, -1.0f, 1.0f );
	glTranslatef( 0, 0, 0 );

	glMatrixMode( GL_MODELVIEW );
	glLoadIdentity();
	glTranslatef( 0, 0, 0 );

	glMatrixMode( GL_TEXTURE );
	glLoadIdentity();
	glTranslatef( 0, 0, 0 );

	glDepthRangef( 0.0f, 1.0f );

	// PSGL doesn't clear the screen on startup, so let's do that here.
	glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
	psglSwap();

	return true;
}


//-----------------------------------------------------------------------------
// Purpose: Initialize the debug font library
//-----------------------------------------------------------------------------
bool CGameEnginePS3::BInitializeCellDbgFont()
{
	// initialize debug font library, then open 2 consoles
	CellDbgFontConfig cfg;
	cfg.bufSize      = 4096;
	cfg.screenWidth  = m_nWindowWidth;
	cfg.screenHeight = m_nWindowHeight;
	if ( cellDbgFontInit( &cfg) != CELL_OK )
	{
		OutputDebugString( "Failed initializing CellDbgFont\n" );
	}

	CellDbgFontConsoleConfig ccfg0;
	ccfg0.posLeft     = 0.18f;
	ccfg0.posTop      = 0.82f;
	ccfg0.cnsWidth    = 128;
	ccfg0.cnsHeight   = 8;
	ccfg0.scale       = 0.65f;
	ccfg0.color       = 0xff0080ff;  // ABGR -> orange
	g_DbgFontConsoleID = m_DbgFontConsoleID = cellDbgFontConsoleOpen( &ccfg0 );
	if ( g_DbgFontConsoleID < 0 )
	{
		OutputDebugString( "Failed creating CellDbgFontConsole\n" );
	}

	return true;
}