Use GL_TEXTURE_RECTANGLE_ARB instead GL_TEXTURE_RECTANGLE_NV hoping for better ati support

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@776 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee 2008-10-05 05:39:59 +00:00
parent c69506bb46
commit 4782f893d7
3 changed files with 55 additions and 55 deletions

View File

@ -156,18 +156,18 @@ bool Renderer::Create2()
// create the framebuffer targets // create the framebuffer targets
glGenTextures(ARRAYSIZE(s_RenderTargets), (GLuint *)s_RenderTargets); glGenTextures(ARRAYSIZE(s_RenderTargets), (GLuint *)s_RenderTargets);
for(u32 i = 0; i < ARRAYSIZE(s_RenderTargets); ++i) { for(u32 i = 0; i < ARRAYSIZE(s_RenderTargets); ++i) {
glBindTexture(GL_TEXTURE_RECTANGLE_NV, s_RenderTargets[i]); glBindTexture(GL_TEXTURE_RECTANGLE_ARB, s_RenderTargets[i]);
// initialize to default // initialize to default
glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, 4, nBackbufferWidth, nBackbufferHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 4, nBackbufferWidth, nBackbufferHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
if( glGetError() != GL_NO_ERROR) { if( glGetError() != GL_NO_ERROR) {
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_T, GL_CLAMP); glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP);
GL_REPORT_ERROR(); GL_REPORT_ERROR();
} }
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
} }
s_nCurTarget = 0; s_nCurTarget = 0;
@ -179,18 +179,18 @@ bool Renderer::Create2()
if( nMaxMRT > 1 ) { if( nMaxMRT > 1 ) {
// create zbuffer target // create zbuffer target
glGenTextures(1, (GLuint *)&s_ZBufferTarget); glGenTextures(1, (GLuint *)&s_ZBufferTarget);
glBindTexture(GL_TEXTURE_RECTANGLE_NV, s_ZBufferTarget); glBindTexture(GL_TEXTURE_RECTANGLE_ARB, s_ZBufferTarget);
glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, 4, nBackbufferWidth, nBackbufferHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 4, nBackbufferWidth, nBackbufferHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
if( glGetError() != GL_NO_ERROR) { if( glGetError() != GL_NO_ERROR) {
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_T, GL_CLAMP); glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP);
GL_REPORT_ERROR(); GL_REPORT_ERROR();
} }
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
} }
// create the depth buffer // create the depth buffer
@ -206,15 +206,15 @@ bool Renderer::Create2()
GL_REPORT_ERROR(); GL_REPORT_ERROR();
// set as render targets // set as render targets
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_NV, s_RenderTargets[s_nCurTarget], 0 ); glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_ARB, s_RenderTargets[s_nCurTarget], 0 );
glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, s_DepthTarget ); glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, s_DepthTarget );
GL_REPORT_ERROR(); GL_REPORT_ERROR();
if( s_ZBufferTarget != 0 ) { if( s_ZBufferTarget != 0 ) {
// test to make sure it works // test to make sure it works
glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT, GL_TEXTURE_RECTANGLE_NV, s_ZBufferTarget, 0); glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT, GL_TEXTURE_RECTANGLE_ARB, s_ZBufferTarget, 0);
bool bFailed = glGetError() != GL_NO_ERROR || glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) != GL_FRAMEBUFFER_COMPLETE_EXT; bool bFailed = glGetError() != GL_NO_ERROR || glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) != GL_FRAMEBUFFER_COMPLETE_EXT;
glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT, GL_TEXTURE_RECTANGLE_NV, 0, 0); glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT, GL_TEXTURE_RECTANGLE_ARB, 0, 0);
if( bFailed ) { if( bFailed ) {
glDeleteTextures(1, (GLuint *)&s_ZBufferTarget); glDeleteTextures(1, (GLuint *)&s_ZBufferTarget);
@ -471,7 +471,7 @@ bool Renderer::CanBlendLogicOp()
void Renderer::SetRenderTarget(u32 targ) void Renderer::SetRenderTarget(u32 targ)
{ {
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_NV, targ!=0?targ:s_RenderTargets[s_nCurTarget], 0 ); glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_ARB, targ!=0?targ:s_RenderTargets[s_nCurTarget], 0 );
} }
void Renderer::SetDepthTarget(u32 targ) void Renderer::SetDepthTarget(u32 targ)
@ -531,7 +531,7 @@ void Renderer::SetZBufferRender()
nZBufferRender = 10; // give it 10 frames nZBufferRender = 10; // give it 10 frames
GLenum s_drawbuffers[2] = {GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT1_EXT}; GLenum s_drawbuffers[2] = {GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT1_EXT};
glDrawBuffers(2, s_drawbuffers); glDrawBuffers(2, s_drawbuffers);
glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT, GL_TEXTURE_RECTANGLE_NV, s_ZBufferTarget, 0); glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT, GL_TEXTURE_RECTANGLE_ARB, s_ZBufferTarget, 0);
_assert_(glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) == GL_FRAMEBUFFER_COMPLETE_EXT); _assert_(glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) == GL_FRAMEBUFFER_COMPLETE_EXT);
} }
@ -547,7 +547,7 @@ void Renderer::FlushZBufferAlphaToTarget()
// texture map s_RenderTargets[s_curtarget] onto the main buffer // texture map s_RenderTargets[s_curtarget] onto the main buffer
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_RECTANGLE_NV, s_ZBufferTarget); glBindTexture(GL_TEXTURE_RECTANGLE_ARB, s_ZBufferTarget);
TextureMngr::EnableTexRECT(0); TextureMngr::EnableTexRECT(0);
// disable all other stages // disable all other stages
for(int i = 1; i < 8; ++i) TextureMngr::DisableStage(i); for(int i = 1; i < 8; ++i) TextureMngr::DisableStage(i);
@ -566,7 +566,7 @@ void Renderer::FlushZBufferAlphaToTarget()
GL_REPORT_ERRORD(); GL_REPORT_ERRORD();
glBindTexture(GL_TEXTURE_RECTANGLE_NV, 0); glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
RestoreGLState(); RestoreGLState();
} }
@ -659,7 +659,7 @@ void Renderer::Swap(const TRectangle& rc)
// texture map s_RenderTargets[s_curtarget] onto the main buffer // texture map s_RenderTargets[s_curtarget] onto the main buffer
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_RECTANGLE_NV, s_RenderTargets[s_nCurTarget]); glBindTexture(GL_TEXTURE_RECTANGLE_ARB, s_RenderTargets[s_nCurTarget]);
TextureMngr::EnableTexRECT(0); TextureMngr::EnableTexRECT(0);
// disable all other stages // disable all other stages
for(int i = 1; i < 8; ++i) TextureMngr::DisableStage(i); for(int i = 1; i < 8; ++i) TextureMngr::DisableStage(i);
@ -672,7 +672,7 @@ void Renderer::Swap(const TRectangle& rc)
glTexCoord2f((float)GetTargetWidth(), 0); glVertex2f(1,-1); glTexCoord2f((float)GetTargetWidth(), 0); glVertex2f(1,-1);
glEnd(); glEnd();
glBindTexture(GL_TEXTURE_RECTANGLE_NV, 0); glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
TextureMngr::DisableStage(0); TextureMngr::DisableStage(0);
static int fpscount; static int fpscount;
@ -766,7 +766,7 @@ void Renderer::Swap(const TRectangle& rc)
// turn off // turn off
nZBufferRender = 0; nZBufferRender = 0;
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT, GL_TEXTURE_RECTANGLE_NV, 0, 0); glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT, GL_TEXTURE_RECTANGLE_ARB, 0, 0);
Renderer::SetRenderMode(RM_Normal); // turn off any zwrites Renderer::SetRenderMode(RM_Normal); // turn off any zwrites
} }
} }
@ -778,7 +778,7 @@ void Renderer::Swap(const TRectangle& rc)
// for testing zbuffer targets // for testing zbuffer targets
//Renderer::SetZBufferRender(); //Renderer::SetZBufferRender();
//SaveTexture("tex.tga", GL_TEXTURE_RECTANGLE_NV, s_ZBufferTarget, GetTargetWidth(), GetTargetHeight()); //SaveTexture("tex.tga", GL_TEXTURE_RECTANGLE_ARB, s_ZBufferTarget, GetTargetWidth(), GetTargetHeight());
} }
bool Renderer::SaveRenderTarget(const char* filename, int jpeg) bool Renderer::SaveRenderTarget(const char* filename, int jpeg)

View File

@ -59,8 +59,8 @@ void TextureMngr::TCacheEntry::SetTextureParameters(TexMode0& newmode)
mode = newmode; mode = newmode;
if( isNonPow2 ) { if( isNonPow2 ) {
// very limited! // very limited!
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, (newmode.mag_filter||g_Config.bForceFiltering)?GL_LINEAR:GL_NEAREST); glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, (newmode.mag_filter||g_Config.bForceFiltering)?GL_LINEAR:GL_NEAREST);
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, (g_Config.bForceFiltering||newmode.min_filter>=4)?GL_LINEAR:GL_NEAREST); glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, (g_Config.bForceFiltering||newmode.min_filter>=4)?GL_LINEAR:GL_NEAREST);
if( newmode.wrap_s == 2 || newmode.wrap_t == 2 ) { if( newmode.wrap_s == 2 || newmode.wrap_t == 2 ) {
DEBUG_LOG("cannot support mirrorred repeat mode\n"); DEBUG_LOG("cannot support mirrorred repeat mode\n");
} }
@ -207,8 +207,8 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width
if(entry.isRenderTarget || (((u32 *)ptr)[entry.hashoffset] == entry.hash && palhash == entry.paletteHash)) { //stupid, improve if(entry.isRenderTarget || (((u32 *)ptr)[entry.hashoffset] == entry.hash && palhash == entry.paletteHash)) { //stupid, improve
entry.frameCount = frameCount; entry.frameCount = frameCount;
//glEnable(entry.isNonPow2?GL_TEXTURE_RECTANGLE_NV:GL_TEXTURE_2D); //glEnable(entry.isNonPow2?GL_TEXTURE_RECTANGLE_ARB:GL_TEXTURE_2D);
glBindTexture(entry.isNonPow2?GL_TEXTURE_RECTANGLE_NV:GL_TEXTURE_2D, entry.texture); glBindTexture(entry.isNonPow2?GL_TEXTURE_RECTANGLE_ARB:GL_TEXTURE_2D, entry.texture);
if (entry.mode.hex != tm0.hex) if (entry.mode.hex != tm0.hex)
entry.SetTextureParameters(tm0); entry.SetTextureParameters(tm0);
return &entry; return &entry;
@ -255,7 +255,7 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width
entry.isNonPow2 = ((width&(width-1)) || (height&(height-1))); entry.isNonPow2 = ((width&(width-1)) || (height&(height-1)));
glGenTextures(1, (GLuint *)&entry.texture); glGenTextures(1, (GLuint *)&entry.texture);
GLenum target = entry.isNonPow2 ? GL_TEXTURE_RECTANGLE_NV : GL_TEXTURE_2D; GLenum target = entry.isNonPow2 ? GL_TEXTURE_RECTANGLE_ARB : GL_TEXTURE_2D;
glBindTexture(target, entry.texture); glBindTexture(target, entry.texture);
if (expandedWidth != width) if (expandedWidth != width)
@ -298,7 +298,7 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width
INCSTAT(stats.numTexturesCreated); INCSTAT(stats.numTexturesCreated);
SETSTAT(stats.numTexturesAlive,textures.size()); SETSTAT(stats.numTexturesAlive,textures.size());
//glEnable(entry.isNonPow2?GL_TEXTURE_RECTANGLE_NV:GL_TEXTURE_2D); //glEnable(entry.isNonPow2?GL_TEXTURE_RECTANGLE_ARB:GL_TEXTURE_2D);
//SaveTexture("tex.tga", target, entry.texture, entry.w, entry.h); //SaveTexture("tex.tga", target, entry.texture, entry.w, entry.h);
return &entry; return &entry;
@ -336,8 +336,8 @@ void TextureMngr::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool
if( !bIsInit ) { if( !bIsInit ) {
glGenTextures(1, (GLuint *)&entry.texture); glGenTextures(1, (GLuint *)&entry.texture);
glBindTexture(GL_TEXTURE_RECTANGLE_NV, entry.texture); glBindTexture(GL_TEXTURE_RECTANGLE_ARB, entry.texture);
glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, 4, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 4, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
GL_REPORT_ERRORD(); GL_REPORT_ERRORD();
} }
else { else {
@ -345,7 +345,7 @@ void TextureMngr::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool
bool bReInit = true; bool bReInit = true;
if( entry.w == w && entry.h == h ) { if( entry.w == w && entry.h == h ) {
glBindTexture(GL_TEXTURE_RECTANGLE_NV, entry.texture); glBindTexture(GL_TEXTURE_RECTANGLE_ARB, entry.texture);
// for some reason mario sunshine errors here... // for some reason mario sunshine errors here...
GLenum err = GL_NO_ERROR; GLenum err = GL_NO_ERROR;
GL_REPORT_ERROR(); GL_REPORT_ERROR();
@ -357,21 +357,21 @@ void TextureMngr::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool
// necessary, for some reason opengl gives errors when texture isn't deleted // necessary, for some reason opengl gives errors when texture isn't deleted
glDeleteTextures(1,(GLuint *)&entry.texture); glDeleteTextures(1,(GLuint *)&entry.texture);
glGenTextures(1, (GLuint *)&entry.texture); glGenTextures(1, (GLuint *)&entry.texture);
glBindTexture(GL_TEXTURE_RECTANGLE_NV, entry.texture); glBindTexture(GL_TEXTURE_RECTANGLE_ARB, entry.texture);
glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, 4, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 4, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
GL_REPORT_ERRORD(); GL_REPORT_ERRORD();
} }
} }
if( !bIsInit || !entry.isRenderTarget ) { if( !bIsInit || !entry.isRenderTarget ) {
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
if( glGetError() != GL_NO_ERROR) { if( glGetError() != GL_NO_ERROR) {
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_T, GL_CLAMP); glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP);
GL_REPORT_ERRORD(); GL_REPORT_ERRORD();
} }
} }
@ -487,7 +487,7 @@ void TextureMngr::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool
// _assert_( glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) == GL_FRAMEBUFFER_COMPLETE_EXT ); // _assert_( glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) == GL_FRAMEBUFFER_COMPLETE_EXT );
// glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); // glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
// GL_REPORT_ERRORD(); // GL_REPORT_ERRORD();
// glCopyTexSubImage2D(GL_TEXTURE_RECTANGLE_NV, 0, 0, 0, source->left, source->top, source->right-source->left, source->bottom-source->top); // glCopyTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 0, 0, source->left, source->top, source->right-source->left, source->bottom-source->top);
// entry.isUpsideDown = true; // note that the copy is upside down!! // entry.isUpsideDown = true; // note that the copy is upside down!!
// GL_REPORT_ERRORD(); // GL_REPORT_ERRORD();
// return; // return;
@ -528,7 +528,7 @@ void TextureMngr::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_RECTANGLE_NV, bFromZBuffer?Renderer::GetZBufferTarget():Renderer::GetRenderTarget()); glBindTexture(GL_TEXTURE_RECTANGLE_ARB, bFromZBuffer?Renderer::GetZBufferTarget():Renderer::GetRenderTarget());
TextureMngr::EnableTexRECT(0); TextureMngr::EnableTexRECT(0);
glViewport(0, 0, w, h); glViewport(0, 0, w, h);
@ -557,8 +557,8 @@ void TextureMngr::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool
Renderer::SetZBufferRender(); // notify for future settings Renderer::SetZBufferRender(); // notify for future settings
GL_REPORT_ERRORD(); GL_REPORT_ERRORD();
//SaveTexture("frame.tga", GL_TEXTURE_RECTANGLE_NV, entry.texture, entry.w, entry.h); //SaveTexture("frame.tga", GL_TEXTURE_RECTANGLE_ARB, entry.texture, entry.w, entry.h);
//SaveTexture("tex.tga", GL_TEXTURE_RECTANGLE_NV, Renderer::GetZBufferTarget(), Renderer::GetTargetWidth(), Renderer::GetTargetHeight()); //SaveTexture("tex.tga", GL_TEXTURE_RECTANGLE_ARB, Renderer::GetZBufferTarget(), Renderer::GetTargetWidth(), Renderer::GetTargetHeight());
} }
void TextureMngr::EnableTex2D(int stage) void TextureMngr::EnableTex2D(int stage)
@ -569,7 +569,7 @@ void TextureMngr::EnableTex2D(int stage)
} }
if( nTexRECTEnabled & (1<<stage) ) { if( nTexRECTEnabled & (1<<stage) ) {
nTexRECTEnabled &= ~(1<<stage); nTexRECTEnabled &= ~(1<<stage);
glDisable(GL_TEXTURE_RECTANGLE_NV); glDisable(GL_TEXTURE_RECTANGLE_ARB);
} }
} }
@ -581,7 +581,7 @@ void TextureMngr::EnableTexRECT(int stage)
} }
if( !(nTexRECTEnabled & (1<<stage)) ) { if( !(nTexRECTEnabled & (1<<stage)) ) {
nTexRECTEnabled |= (1<<stage); nTexRECTEnabled |= (1<<stage);
glEnable(GL_TEXTURE_RECTANGLE_NV); glEnable(GL_TEXTURE_RECTANGLE_ARB);
} }
} }
@ -597,6 +597,6 @@ void TextureMngr::DisableStage(int stage)
if( nTexRECTEnabled & (1<<stage) ) { if( nTexRECTEnabled & (1<<stage) ) {
nTexRECTEnabled &= ~(1<<stage); nTexRECTEnabled &= ~(1<<stage);
if( !bset ) glActiveTexture(GL_TEXTURE0+stage); if( !bset ) glActiveTexture(GL_TEXTURE0+stage);
glDisable(GL_TEXTURE_RECTANGLE_NV); glDisable(GL_TEXTURE_RECTANGLE_ARB);
} }
} }

View File

@ -36,16 +36,16 @@ void XFB_Init()
xfb_buffer = new u8[XFB_WIDTH * XFB_HEIGHT * 4]; xfb_buffer = new u8[XFB_WIDTH * XFB_HEIGHT * 4];
memset(xfb_buffer, 0, XFB_WIDTH * XFB_HEIGHT * 4); memset(xfb_buffer, 0, XFB_WIDTH * XFB_HEIGHT * 4);
glGenTextures(1, &xfb_texture); glGenTextures(1, &xfb_texture);
glBindTexture(GL_TEXTURE_RECTANGLE_NV, xfb_texture); glBindTexture(GL_TEXTURE_RECTANGLE_ARB, xfb_texture);
glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, 4, XFB_WIDTH, XFB_HEIGHT, 0, GL_BGRA, GL_UNSIGNED_BYTE, xfb_buffer); glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 4, XFB_WIDTH, XFB_HEIGHT, 0, GL_BGRA, GL_UNSIGNED_BYTE, xfb_buffer);
} }
void XFB_Draw(u8 *xfb_in_ram) void XFB_Draw(u8 *xfb_in_ram)
{ {
Renderer::ResetGLState(); Renderer::ResetGLState();
ConvertXFB((u32 *)xfb_buffer, xfb_in_ram, XFB_WIDTH, XFB_HEIGHT); ConvertXFB((u32 *)xfb_buffer, xfb_in_ram, XFB_WIDTH, XFB_HEIGHT);
glBindTexture(GL_TEXTURE_RECTANGLE_NV, xfb_texture); glBindTexture(GL_TEXTURE_RECTANGLE_ARB, xfb_texture);
glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, 4, XFB_WIDTH, XFB_HEIGHT, 0, GL_BGRA, GL_UNSIGNED_BYTE, xfb_buffer); glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 4, XFB_WIDTH, XFB_HEIGHT, 0, GL_BGRA, GL_UNSIGNED_BYTE, xfb_buffer);
TextureMngr::EnableTexRECT(0); TextureMngr::EnableTexRECT(0);
for (int i = 1; i < 8; ++i) for (int i = 1; i < 8; ++i)
TextureMngr::DisableStage(i); TextureMngr::DisableStage(i);