예제 #1
0
파일: drawGX.c 프로젝트: emukidid/pcsxgc
unsigned long ulInitDisplay(void)
{
	bUsingTWin=FALSE;

	InitMenu();

	bIsFirstFrame = FALSE;                                // done

	if(iShowFPS)
	{
		iShowFPS=0;
		ulKeybits|=KEY_SHOWFPS;
		szDispBuf[0]=0;
		BuildDispMenu(0);
	}

//	iColDepth=16;	//only needed by ShowGunCursor

//	Xpixels = memalign(32,iResX_Max*iResY_Max*2);	//For now these are for 16bit color.
	memset(Xpixels,0,iResX_Max*iResY_Max*2);
//	GXtexture = memalign(32,iResX_Max*iResY_Max*2);
	memset(GXtexture,0,iResX_Max*iResY_Max*2);

	return (unsigned long)Xpixels;		//This isn't right, but didn't want to return 0..
}
예제 #2
0
int GLinitialize() 
{
 glViewport(rRatioRect.left,                           // init viewport by ratio rect
            iResY-(rRatioRect.top+rRatioRect.bottom),
            rRatioRect.right, 
            rRatioRect.bottom);         
                                                      
 glScissor(0, 0, iResX, iResY);                        // init clipping (fullscreen)
 glEnable(GL_SCISSOR_TEST);                       

#ifndef OWNSCALE
 glMatrixMode(GL_TEXTURE);                             // init psx tex sow and tow if not "ownscale"
 glLoadIdentity();
 glScalef(1.0f/255.99f,1.0f/255.99f,1.0f);             // geforce precision hack
#endif 

 glMatrixMode(GL_PROJECTION);                          // init projection with psx resolution
 glLoadIdentity();
 glOrtho(0,PSXDisplay.DisplayMode.x,
         PSXDisplay.DisplayMode.y, 0, -1, 1);

 if(iZBufferDepth)                                     // zbuffer?
  {
   uiBufferBits=GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT;
   glEnable(GL_DEPTH_TEST);    
   glDepthFunc(GL_ALWAYS);
   iDepthFunc=1;
  }
 else                                                  // no zbuffer?
  {
   uiBufferBits=GL_COLOR_BUFFER_BIT;
   glDisable(GL_DEPTH_TEST);
  }

 glClearColor(0.0f, 0.0f, 0.0f, 0.0f);                 // first buffer clear
 glClear(uiBufferBits);

 if(bUseLines)                                         // funny lines 
  {
   glPolygonMode(GL_FRONT, GL_LINE); 
   glPolygonMode(GL_BACK, GL_LINE); 
  }
 else                                                  // or the real filled thing
  {
   glPolygonMode(GL_FRONT, GL_FILL);
   glPolygonMode(GL_BACK, GL_FILL);
  }

 MakeDisplayLists();                                   // lists for menu/opaque
 GetExtInfos();                                        // get ext infos
 SetExtGLFuncs();                                      // init all kind of stuff (tex function pointers)
 
 glEnable(GL_ALPHA_TEST);                              // wanna alpha test

 if(!bUseAntiAlias)                                    // no anti-alias (default)
  {
   glDisable(GL_LINE_SMOOTH);
   glDisable(GL_POLYGON_SMOOTH);
   glDisable(GL_POINT_SMOOTH);
  }
 else                                                  // wanna try it? glitches galore...
  {                    
   glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST);
   glEnable(GL_LINE_SMOOTH);
   glEnable(GL_POLYGON_SMOOTH);
   glEnable(GL_POINT_SMOOTH);
   glHint(GL_LINE_SMOOTH_HINT,GL_NICEST);
   glHint(GL_POINT_SMOOTH_HINT,GL_NICEST);
   glHint(GL_POLYGON_SMOOTH_HINT,GL_NICEST);
  }

 ubGloAlpha=127;                                       // init some drawing vars
 ubGloColAlpha=127;
 TWin.UScaleFactor = 1;
 TWin.VScaleFactor = 1;
 bDrawMultiPass=FALSE;
 bTexEnabled=FALSE;
 bUsingTWin=FALSE;
      
 if(bDrawDither)  glEnable(GL_DITHER);                 // dither mode
 else             glDisable(GL_DITHER); 

 glDisable(GL_FOG);                                    // turn all (currently) unused modes off
 glDisable(GL_LIGHTING);  
 glDisable(GL_LOGIC_OP);
 glDisable(GL_STENCIL_TEST);  
 glDisable(GL_TEXTURE_1D);
 glDisable(GL_TEXTURE_2D);
 glDisable(GL_CULL_FACE);

 glPixelTransferi(GL_RED_SCALE, 1);                    // to be sure:
 glPixelTransferi(GL_RED_BIAS, 0);                     // init more OGL vals
 glPixelTransferi(GL_GREEN_SCALE, 1);
 glPixelTransferi(GL_GREEN_BIAS, 0);
 glPixelTransferi(GL_BLUE_SCALE, 1);
 glPixelTransferi(GL_BLUE_BIAS, 0);
 glPixelTransferi(GL_ALPHA_SCALE, 1);
 glPixelTransferi(GL_ALPHA_BIAS, 0);                                                  

 printf(glGetString(GL_VENDOR));                       // linux: tell user what is getting used
 printf("\n");
 printf(glGetString(GL_RENDERER));
 printf("\n");

 glFlush();                                            // we are done...
 glFinish();                           

 CreateScanLines();                                    // setup scanline stuff (if wanted)

 CheckTextureMemory();                                 // check available tex memory

 if(bKeepRatio) SetAspectRatio();                      // set ratio

 if(iShowFPS)                                          // user wants FPS display on startup?
  {
   ulKeybits|=KEY_SHOWFPS;                             // -> ok, turn display on
   szDispBuf[0]=0;
   BuildDispMenu(0);
  }
 
 bIsFirstFrame = FALSE;                                // we have survived the first frame :)

 return 0;
}
예제 #3
0
파일: menu.c 프로젝트: gcfavorites/feos-tas
void SwitchDispMenu(int iStep)                         // SWITCH DISP MENU
{
	if (!(ulKeybits&KEY_SHOWFPS)) return;                 // tststs

	switch (iMPos)
	{//////////////////////////////////////////////////////
	case 0:                                             // frame limit
	{
		int iType=0;
		bInitCap = TRUE;

#ifdef _WINDOWS
		if (iFrameLimit==1 && UseFrameLimit &&
		    GetAsyncKeyState(VK_SHIFT)&32768)
		{
			fFrameRate+=iStep;
			if (fFrameRate<1.0f) fFrameRate=1.0f;
			SetAutoFrameCap();
			break;
		}
#endif

		if (UseFrameLimit) iType=iFrameLimit;
		iType+=iStep;
		if (iType<0) iType=2;
		if (iType>2) iType=0;
		if (iType==0) UseFrameLimit=0;
		else
		{
			UseFrameLimit=1;
			iFrameLimit=iType;
			SetAutoFrameCap();
		}
	}
	break;
	//////////////////////////////////////////////////////
	case 1:                                             // frame skip
		bInitCap = TRUE;
		if (iStep>0)
		{
			if (!UseFrameSkip)
			{
				UseFrameSkip=1;
				iFastFwd = 0;
			}
			else
			{
				if (!iFastFwd) iFastFwd=1;
				else
				{
					UseFrameSkip=0;
					iFastFwd = 0;
				}
			}
		}
		else
		{
			if (!UseFrameSkip)
			{
				UseFrameSkip=1;
				iFastFwd = 1;
			}
			else
			{
				if (iFastFwd) iFastFwd=0;
				else
				{
					UseFrameSkip=0;
					iFastFwd = 0;
				}
			}
		}
		bSkipNextFrame=FALSE;
		break;
		//////////////////////////////////////////////////////
	case 2:                                             // dithering
		iUseDither+=iStep;
		if (iUseDither<0) iUseDither=2;
		if (iUseDither>2) iUseDither=0;
		break;
		//////////////////////////////////////////////////////
	case 3:                                             // special fixes
		if (iUseFixes)
		{
			iUseFixes=0;
			dwActFixes=0;
		}
		else
		{
			iUseFixes=1;
			dwActFixes=dwCfgFixes;
		}
		SetFixes();
		if (iFrameLimit==2) SetAutoFrameCap();
		break;
	}

	BuildDispMenu(0);                                     // update info
}