support GL_ARB_texture_float

This commit is contained in:
Glenn Maynard
2007-02-24 12:33:16 +00:00
parent 0160e23705
commit d866e18ca3
5 changed files with 17 additions and 2 deletions
+4
View File
@@ -11,6 +11,7 @@ ActorFrameTexture::ActorFrameTexture()
{
m_bDepthBuffer = false;
m_bAlphaBuffer = false;
m_bFloat = false;
m_bPreserveTexture = false;
static uint64_t i = 0;
++i;
@@ -37,6 +38,7 @@ void ActorFrameTexture::Create()
RenderTargetParam param;
param.bWithDepthBuffer = m_bDepthBuffer;
param.bWithAlpha = m_bAlphaBuffer;
param.bFloat = m_bFloat;
param.iWidth = (int) m_size.x;
param.iHeight = (int) m_size.y;
m_pRenderTarget = new RageTextureRenderTarget( id, param );
@@ -67,6 +69,7 @@ public:
static int Create( T* p, lua_State *L ) { p->Create(); return 0; }
static int EnableDepthBuffer( T* p, lua_State *L ) { p->EnableDepthBuffer(BArg(1)); return 0; }
static int EnableAlphaBuffer( T* p, lua_State *L ) { p->EnableAlphaBuffer(BArg(1)); return 0; }
static int EnableFloat( T* p, lua_State *L ) { p->EnableFloat(BArg(1)); return 0; }
static int EnablePreserveTexture( T* p, lua_State *L ) { p->EnablePreserveTexture(BArg(1)); return 0; }
static int SetTextureName( T* p, lua_State *L ) { p->SetTextureName(SArg(1)); return 0; }
static int GetTexture( T* p, lua_State *L )
@@ -83,6 +86,7 @@ public:
ADD_METHOD( Create );
ADD_METHOD( EnableDepthBuffer );
ADD_METHOD( EnableAlphaBuffer );
ADD_METHOD( EnableFloat );
ADD_METHOD( EnablePreserveTexture );
ADD_METHOD( SetTextureName );
ADD_METHOD( GetTexture );
+2
View File
@@ -22,6 +22,7 @@ public:
void EnableDepthBuffer( bool b ) { m_bDepthBuffer = b; }
void EnableAlphaBuffer( bool b ) { m_bAlphaBuffer = b; }
void EnableFloat( bool b ) { m_bFloat = b; }
void EnablePreserveTexture( bool b ) { m_bPreserveTexture = b; }
void Create();
@@ -38,6 +39,7 @@ private:
bool m_bDepthBuffer;
bool m_bAlphaBuffer;
bool m_bFloat;
bool m_bPreserveTexture;
RString m_sTextureName;
};
+9 -2
View File
@@ -2132,8 +2132,15 @@ void RenderTarget_FramebufferObject::Create( const RenderTargetParam &param, int
iTextureHeightOut = iTextureHeight;
glBindTexture( GL_TEXTURE_2D, m_iTexHandle );
glTexImage2D( GL_TEXTURE_2D, 0, param.bWithAlpha? GL_RGBA8:GL_RGB8,
iTextureWidth, iTextureHeight, 0, param.bWithAlpha? GL_RGBA:GL_RGB, GL_UNSIGNED_BYTE, NULL );
GLenum internalformat;
GLenum type = param.bWithAlpha? GL_RGBA:GL_RGB;
if( param.bFloat && GLExt.m_bGL_ARB_texture_float )
internalformat = param.bWithAlpha? GL_RGBA16F_ARB:GL_RGB16F_ARB;
else
internalformat = param.bWithAlpha? GL_RGBA8:GL_RGB8;
glTexImage2D( GL_TEXTURE_2D, 0, internalformat,
iTextureWidth, iTextureHeight, 0, type, GL_UNSIGNED_BYTE, NULL );
AssertNoGLError();
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
@@ -106,6 +106,7 @@ void GLExt_t::Load( LowLevelWindow *pWind )
m_bARB_texture_env_combine = HasExtension("GL_ARB_texture_env_combine");
m_bEXT_texture_env_combine = HasExtension("GL_EXT_texture_env_combine");
m_bGL_EXT_bgra = HasExtension("GL_EXT_bgra");
m_bGL_ARB_texture_float = HasExtension("GL_ARB_texture_float");
#if defined(WIN32)
if( HasExtension("WGL_EXT_swap_control") )
+1
View File
@@ -65,6 +65,7 @@ struct GLExt_t
bool m_bARB_texture_env_combine;
bool m_bEXT_texture_env_combine;
bool m_bGL_EXT_bgra;
bool m_bGL_ARB_texture_float;
PWSWAPINTERVALEXTPROC wglSwapIntervalEXT;
PFNGLCOLORTABLEPROC glColorTableEXT;