RageDisplay::GetTexture, mostly for debugging for now
This commit is contained in:
@@ -292,6 +292,7 @@ public:
|
|||||||
|
|
||||||
virtual RString GetTextureDiagnostics( unsigned id ) const { return RString(); }
|
virtual RString GetTextureDiagnostics( unsigned id ) const { return RString(); }
|
||||||
virtual RageSurface* CreateScreenshot() = 0; // allocates a surface. Caller must delete it.
|
virtual RageSurface* CreateScreenshot() = 0; // allocates a surface. Caller must delete it.
|
||||||
|
virtual RageSurface *GetTexture( unsigned iTexture ) { return NULL; } // allocates a surface. Caller must delete it.
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void DrawQuadsInternal( const RageSpriteVertex v[], int iNumVerts ) = 0;
|
virtual void DrawQuadsInternal( const RageSpriteVertex v[], int iNumVerts ) = 0;
|
||||||
|
|||||||
@@ -763,6 +763,30 @@ RageSurface* RageDisplay_OGL::CreateScreenshot()
|
|||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RageSurface *RageDisplay_OGL::GetTexture( unsigned iTexture )
|
||||||
|
{
|
||||||
|
if( iTexture == 0 )
|
||||||
|
return NULL; // XXX
|
||||||
|
|
||||||
|
FlushGLErrors();
|
||||||
|
|
||||||
|
glBindTexture( GL_TEXTURE_2D, iTexture );
|
||||||
|
GLint iHeight, iWidth, iAlphaBits;
|
||||||
|
glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &iHeight );
|
||||||
|
glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &iWidth );
|
||||||
|
glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_ALPHA_SIZE, &iAlphaBits );
|
||||||
|
int iFormat = iAlphaBits? PixelFormat_RGBA8:PixelFormat_RGB8;
|
||||||
|
|
||||||
|
const PixelFormatDesc &desc = PIXEL_FORMAT_DESC[iFormat];
|
||||||
|
RageSurface *pImage = CreateSurface( iWidth, iHeight, desc.bpp,
|
||||||
|
desc.masks[0], desc.masks[1], desc.masks[2], desc.masks[3] );
|
||||||
|
|
||||||
|
glGetTexImage( GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, pImage->pixels );
|
||||||
|
AssertNoGLError();
|
||||||
|
|
||||||
|
return pImage;
|
||||||
|
}
|
||||||
|
|
||||||
VideoModeParams RageDisplay_OGL::GetActualVideoModeParams() const
|
VideoModeParams RageDisplay_OGL::GetActualVideoModeParams() const
|
||||||
{
|
{
|
||||||
return g_pWind->GetActualVideoModeParams();
|
return g_pWind->GetActualVideoModeParams();
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ public:
|
|||||||
int xoffset, int yoffset, int width, int height
|
int xoffset, int yoffset, int width, int height
|
||||||
);
|
);
|
||||||
void DeleteTexture( unsigned iTexHandle );
|
void DeleteTexture( unsigned iTexHandle );
|
||||||
|
RageSurface *GetTexture( unsigned iTexture );
|
||||||
|
|
||||||
void ClearAllTextures();
|
void ClearAllTextures();
|
||||||
int GetNumTextureUnits();
|
int GetNumTextureUnits();
|
||||||
void SetTexture( TextureUnit tu, unsigned iTexture );
|
void SetTexture( TextureUnit tu, unsigned iTexture );
|
||||||
|
|||||||
Reference in New Issue
Block a user