support GL_ARB_texture_float
This commit is contained in:
@@ -11,6 +11,7 @@ ActorFrameTexture::ActorFrameTexture()
|
|||||||
{
|
{
|
||||||
m_bDepthBuffer = false;
|
m_bDepthBuffer = false;
|
||||||
m_bAlphaBuffer = false;
|
m_bAlphaBuffer = false;
|
||||||
|
m_bFloat = false;
|
||||||
m_bPreserveTexture = false;
|
m_bPreserveTexture = false;
|
||||||
static uint64_t i = 0;
|
static uint64_t i = 0;
|
||||||
++i;
|
++i;
|
||||||
@@ -37,6 +38,7 @@ void ActorFrameTexture::Create()
|
|||||||
RenderTargetParam param;
|
RenderTargetParam param;
|
||||||
param.bWithDepthBuffer = m_bDepthBuffer;
|
param.bWithDepthBuffer = m_bDepthBuffer;
|
||||||
param.bWithAlpha = m_bAlphaBuffer;
|
param.bWithAlpha = m_bAlphaBuffer;
|
||||||
|
param.bFloat = m_bFloat;
|
||||||
param.iWidth = (int) m_size.x;
|
param.iWidth = (int) m_size.x;
|
||||||
param.iHeight = (int) m_size.y;
|
param.iHeight = (int) m_size.y;
|
||||||
m_pRenderTarget = new RageTextureRenderTarget( id, param );
|
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 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 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 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 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 SetTextureName( T* p, lua_State *L ) { p->SetTextureName(SArg(1)); return 0; }
|
||||||
static int GetTexture( T* p, lua_State *L )
|
static int GetTexture( T* p, lua_State *L )
|
||||||
@@ -83,6 +86,7 @@ public:
|
|||||||
ADD_METHOD( Create );
|
ADD_METHOD( Create );
|
||||||
ADD_METHOD( EnableDepthBuffer );
|
ADD_METHOD( EnableDepthBuffer );
|
||||||
ADD_METHOD( EnableAlphaBuffer );
|
ADD_METHOD( EnableAlphaBuffer );
|
||||||
|
ADD_METHOD( EnableFloat );
|
||||||
ADD_METHOD( EnablePreserveTexture );
|
ADD_METHOD( EnablePreserveTexture );
|
||||||
ADD_METHOD( SetTextureName );
|
ADD_METHOD( SetTextureName );
|
||||||
ADD_METHOD( GetTexture );
|
ADD_METHOD( GetTexture );
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ public:
|
|||||||
|
|
||||||
void EnableDepthBuffer( bool b ) { m_bDepthBuffer = b; }
|
void EnableDepthBuffer( bool b ) { m_bDepthBuffer = b; }
|
||||||
void EnableAlphaBuffer( bool b ) { m_bAlphaBuffer = b; }
|
void EnableAlphaBuffer( bool b ) { m_bAlphaBuffer = b; }
|
||||||
|
void EnableFloat( bool b ) { m_bFloat = b; }
|
||||||
void EnablePreserveTexture( bool b ) { m_bPreserveTexture = b; }
|
void EnablePreserveTexture( bool b ) { m_bPreserveTexture = b; }
|
||||||
|
|
||||||
void Create();
|
void Create();
|
||||||
@@ -38,6 +39,7 @@ private:
|
|||||||
|
|
||||||
bool m_bDepthBuffer;
|
bool m_bDepthBuffer;
|
||||||
bool m_bAlphaBuffer;
|
bool m_bAlphaBuffer;
|
||||||
|
bool m_bFloat;
|
||||||
bool m_bPreserveTexture;
|
bool m_bPreserveTexture;
|
||||||
RString m_sTextureName;
|
RString m_sTextureName;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2132,8 +2132,15 @@ void RenderTarget_FramebufferObject::Create( const RenderTargetParam ¶m, int
|
|||||||
iTextureHeightOut = iTextureHeight;
|
iTextureHeightOut = iTextureHeight;
|
||||||
|
|
||||||
glBindTexture( GL_TEXTURE_2D, m_iTexHandle );
|
glBindTexture( GL_TEXTURE_2D, m_iTexHandle );
|
||||||
glTexImage2D( GL_TEXTURE_2D, 0, param.bWithAlpha? GL_RGBA8:GL_RGB8,
|
GLenum internalformat;
|
||||||
iTextureWidth, iTextureHeight, 0, param.bWithAlpha? GL_RGBA:GL_RGB, GL_UNSIGNED_BYTE, NULL );
|
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();
|
AssertNoGLError();
|
||||||
|
|
||||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
|
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_bARB_texture_env_combine = HasExtension("GL_ARB_texture_env_combine");
|
||||||
m_bEXT_texture_env_combine = HasExtension("GL_EXT_texture_env_combine");
|
m_bEXT_texture_env_combine = HasExtension("GL_EXT_texture_env_combine");
|
||||||
m_bGL_EXT_bgra = HasExtension("GL_EXT_bgra");
|
m_bGL_EXT_bgra = HasExtension("GL_EXT_bgra");
|
||||||
|
m_bGL_ARB_texture_float = HasExtension("GL_ARB_texture_float");
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
if( HasExtension("WGL_EXT_swap_control") )
|
if( HasExtension("WGL_EXT_swap_control") )
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ struct GLExt_t
|
|||||||
bool m_bARB_texture_env_combine;
|
bool m_bARB_texture_env_combine;
|
||||||
bool m_bEXT_texture_env_combine;
|
bool m_bEXT_texture_env_combine;
|
||||||
bool m_bGL_EXT_bgra;
|
bool m_bGL_EXT_bgra;
|
||||||
|
bool m_bGL_ARB_texture_float;
|
||||||
|
|
||||||
PWSWAPINTERVALEXTPROC wglSwapIntervalEXT;
|
PWSWAPINTERVALEXTPROC wglSwapIntervalEXT;
|
||||||
PFNGLCOLORTABLEPROC glColorTableEXT;
|
PFNGLCOLORTABLEPROC glColorTableEXT;
|
||||||
|
|||||||
Reference in New Issue
Block a user