2005-02-13 03:27:21 +00:00
|
|
|
/* RageDisplay_OGL: OpenGL renderer. */
|
2004-05-06 00:42:06 +00:00
|
|
|
|
2003-05-26 22:25:23 +00:00
|
|
|
#ifndef RAGEDISPLAY_OGL_H
|
|
|
|
|
#define RAGEDISPLAY_OGL_H
|
|
|
|
|
|
|
|
|
|
class RageDisplay_OGL: public RageDisplay
|
|
|
|
|
{
|
|
|
|
|
public:
|
2004-11-30 22:21:50 +00:00
|
|
|
RageDisplay_OGL();
|
2003-06-14 04:15:35 +00:00
|
|
|
virtual ~RageDisplay_OGL();
|
2004-11-30 22:21:50 +00:00
|
|
|
CString Init( VideoModeParams p, bool bAllowUnacceleratedRenderer );
|
2003-05-26 22:25:23 +00:00
|
|
|
void Update(float fDeltaTime);
|
|
|
|
|
|
|
|
|
|
bool IsSoftwareRenderer();
|
|
|
|
|
void ResolutionChanged();
|
|
|
|
|
const PixelFormatDesc *GetPixelFormatDesc(PixelFormat pf) const;
|
|
|
|
|
|
2004-09-19 01:38:12 +00:00
|
|
|
bool BeginFrame();
|
2003-05-26 22:25:23 +00:00
|
|
|
void EndFrame();
|
2003-06-05 19:29:27 +00:00
|
|
|
VideoModeParams GetVideoModeParams() const;
|
2003-05-26 22:25:23 +00:00
|
|
|
void SetBlendMode( BlendMode mode );
|
2003-11-29 17:56:09 +00:00
|
|
|
bool SupportsTextureFormat( PixelFormat pixfmt, bool realtime=false );
|
2004-01-23 06:20:28 +00:00
|
|
|
unsigned CreateTexture(
|
|
|
|
|
PixelFormat pixfmt,
|
2004-06-14 00:51:00 +00:00
|
|
|
RageSurface* img,
|
2004-01-23 06:20:28 +00:00
|
|
|
bool bGenerateMipMaps );
|
2003-05-26 22:25:23 +00:00
|
|
|
void UpdateTexture(
|
|
|
|
|
unsigned uTexHandle,
|
2004-06-14 00:51:00 +00:00
|
|
|
RageSurface* img,
|
2003-05-26 22:25:23 +00:00
|
|
|
int xoffset, int yoffset, int width, int height
|
|
|
|
|
);
|
|
|
|
|
void DeleteTexture( unsigned uTexHandle );
|
2004-02-04 09:55:18 +00:00
|
|
|
void ClearAllTextures();
|
2005-01-04 05:34:58 +00:00
|
|
|
int GetNumTextureUnits();
|
2004-02-04 09:55:18 +00:00
|
|
|
void SetTexture( int iTextureUnitIndex, RageTexture* pTexture );
|
2003-05-26 22:25:23 +00:00
|
|
|
void SetTextureModeModulate();
|
2005-01-08 22:14:08 +00:00
|
|
|
void SetTextureModeGlow();
|
2004-02-04 09:55:18 +00:00
|
|
|
void SetTextureModeAdd();
|
2003-05-26 22:25:23 +00:00
|
|
|
void SetTextureWrapping( bool b );
|
|
|
|
|
int GetMaxTextureSize() const;
|
|
|
|
|
void SetTextureFiltering( bool b);
|
2003-11-18 20:33:18 +00:00
|
|
|
bool IsZWriteEnabled() const;
|
|
|
|
|
bool IsZTestEnabled() const;
|
|
|
|
|
void SetZWrite( bool b );
|
2005-05-06 04:05:02 +00:00
|
|
|
void SetZBias( float f );
|
2004-05-15 09:26:21 +00:00
|
|
|
void SetZTestMode( ZTestMode mode );
|
2003-05-26 22:25:23 +00:00
|
|
|
void ClearZBuffer();
|
2004-02-04 11:05:33 +00:00
|
|
|
void SetCullMode( CullMode mode );
|
2003-05-26 22:25:23 +00:00
|
|
|
void SetAlphaTest( bool b );
|
|
|
|
|
void SetMaterial(
|
2004-01-06 21:25:46 +00:00
|
|
|
const RageColor &emissive,
|
|
|
|
|
const RageColor &ambient,
|
|
|
|
|
const RageColor &diffuse,
|
|
|
|
|
const RageColor &specular,
|
2003-05-26 22:25:23 +00:00
|
|
|
float shininess
|
|
|
|
|
);
|
|
|
|
|
void SetLighting( bool b );
|
|
|
|
|
void SetLightOff( int index );
|
|
|
|
|
void SetLightDirectional(
|
|
|
|
|
int index,
|
2004-01-06 21:25:46 +00:00
|
|
|
const RageColor &ambient,
|
|
|
|
|
const RageColor &diffuse,
|
|
|
|
|
const RageColor &specular,
|
|
|
|
|
const RageVector3 &dir );
|
2003-05-26 22:25:23 +00:00
|
|
|
|
2005-01-22 03:39:39 +00:00
|
|
|
void SetSphereEnvironmentMapping( bool b );
|
2004-01-06 19:54:13 +00:00
|
|
|
|
2004-04-16 05:09:02 +00:00
|
|
|
RageCompiledGeometry* CreateCompiledGeometry();
|
|
|
|
|
void DeleteCompiledGeometry( RageCompiledGeometry* p );
|
2004-04-08 08:35:38 +00:00
|
|
|
|
2004-06-19 21:00:38 +00:00
|
|
|
// hacks for cell-shaded models
|
|
|
|
|
virtual void SetPolygonMode( PolygonMode pm );
|
2004-06-20 01:26:28 +00:00
|
|
|
virtual void SetLineWidth( float fWidth );
|
2004-06-19 21:00:38 +00:00
|
|
|
|
2003-06-22 01:20:58 +00:00
|
|
|
CString GetTextureDiagnostics( unsigned id ) const;
|
|
|
|
|
|
2003-05-26 22:25:23 +00:00
|
|
|
protected:
|
2004-04-15 05:24:28 +00:00
|
|
|
void DrawQuadsInternal( const RageSpriteVertex v[], int iNumVerts );
|
|
|
|
|
void DrawQuadStripInternal( const RageSpriteVertex v[], int iNumVerts );
|
|
|
|
|
void DrawFanInternal( const RageSpriteVertex v[], int iNumVerts );
|
|
|
|
|
void DrawStripInternal( const RageSpriteVertex v[], int iNumVerts );
|
|
|
|
|
void DrawTrianglesInternal( const RageSpriteVertex v[], int iNumVerts );
|
2004-04-16 05:09:02 +00:00
|
|
|
void DrawCompiledGeometryInternal( const RageCompiledGeometry *p, int iMeshIndex );
|
2004-04-15 05:24:28 +00:00
|
|
|
void DrawLineStripInternal( const RageSpriteVertex v[], int iNumVerts, float LineWidth );
|
|
|
|
|
|
2003-08-27 23:36:09 +00:00
|
|
|
CString TryVideoMode( VideoModeParams params, bool &bNewDeviceOut );
|
2004-06-14 00:51:00 +00:00
|
|
|
RageSurface* CreateScreenshot();
|
2003-05-26 22:25:23 +00:00
|
|
|
void SetViewport(int shift_left, int shift_down);
|
2004-09-26 09:15:16 +00:00
|
|
|
PixelFormat GetImgPixelFormat( RageSurface* &img, bool &FreeImg, int width, int height, bool bPalettedTexture );
|
2003-07-09 03:16:28 +00:00
|
|
|
bool SupportsSurfaceFormat( PixelFormat pixfmt );
|
2004-08-09 00:46:42 +00:00
|
|
|
|
2004-04-08 08:35:38 +00:00
|
|
|
void SendCurrentMatrices();
|
2003-05-26 22:25:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|
2004-05-06 00:42:06 +00:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2001-2004 Chris Danford, Glenn Maynard
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
|
* copy of this software and associated documentation files (the
|
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
|
* distribute, and/or sell copies of the Software, and to permit persons to
|
|
|
|
|
* whom the Software is furnished to do so, provided that the above
|
|
|
|
|
* copyright notice(s) and this permission notice appear in all copies of
|
|
|
|
|
* the Software and that both the above copyright notice(s) and this
|
|
|
|
|
* permission notice appear in supporting documentation.
|
|
|
|
|
*
|
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
|
|
|
|
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
|
|
|
|
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
|
|
|
|
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
|
|
|
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
|
|
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
|
|
* PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
*/
|
|
|
|
|
|