diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2010-05-30 01:31:57 +0400 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2010-05-30 01:31:57 +0400 |
commit | c6bec43330be0874b4116d259bbaf9fb90ed0556 (patch) | |
tree | a1de833c9b4067a0659461ce8af20857678034ed /source/gameengine/Rasterizer | |
parent | 9d3157eed000e7c543d04f5ad3efc5990675903b (diff) |
reverting previous commit from Mitchell. His commit went to the trunk instead of the branch :)
svn merge -r 29067:29066 https://svn.blender.org/svnroot/bf-blender/trunk/blender
Diffstat (limited to 'source/gameengine/Rasterizer')
3 files changed, 8 insertions, 131 deletions
diff --git a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp index c0e08dba992..4527850a8e9 100644 --- a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp +++ b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp @@ -194,15 +194,6 @@ void RAS_2DFilterManager::AnalyseShader(int passindex, vector<STR_String>& propN { texflag[passindex] |= 0x2; } - if(glGetUniformLocationARB(m_filters[passindex], "bgl_QuarteredRenderTexture") != -1) - { - texflag[passindex] |= 0x4; - } - if(glGetUniformLocationARB(m_filters[passindex], "bgl_QuartedDepthTexture") != -1) - { - if(GLEW_ARB_depth_texture) - texflag[passindex] |= 0x8; - } if(m_gameObjects[passindex]) { @@ -250,29 +241,6 @@ void RAS_2DFilterManager::StartShaderProgram(int passindex) glUniform1iARB(uniformLoc, 2); } } - - /* Send the quartered render texture to glsl program if it needs */ - if(texflag[passindex] & 0x4){ - uniformLoc = glGetUniformLocationARB(m_filters[passindex], "bgl_QuarteredRenderTexture"); - glActiveTextureARB(GL_TEXTURE3); - glBindTexture(GL_TEXTURE_2D, texname[3]); - - if (uniformLoc != -1) - { - glUniform1iARB(uniformLoc, 3); - } - } - - if(texflag[passindex] & 0x5){ - uniformLoc = glGetUniformLocationARB(m_filters[passindex], "bgl_QuarteredDepthTexture"); - glActiveTextureARB(GL_TEXTURE4); - glBindTexture(GL_TEXTURE_2D, texname[4]); - - if (uniformLoc != -1) - { - glUniform1iARB(uniformLoc, 4); - } - } uniformLoc = glGetUniformLocationARB(m_filters[passindex], "bgl_TextureCoordinateOffset"); if (uniformLoc != -1) @@ -309,24 +277,15 @@ void RAS_2DFilterManager::EndShaderProgram() void RAS_2DFilterManager::FreeTextures() { - // Update this when adding new textures! - for (int i=0; i<5; i++) - { - if(texname[i]!=(unsigned int)-1) - glDeleteTextures(1, (GLuint*)&texname[i]); - } - - if(fbo != (unsigned int)-1) - glDeleteFramebuffersEXT(1, &fbo); - /*if(texname[0]!=(unsigned int)-1) + if(texname[0]!=(unsigned int)-1) glDeleteTextures(1, (GLuint*)&texname[0]); if(texname[1]!=(unsigned int)-1) glDeleteTextures(1, (GLuint*)&texname[1]); if(texname[2]!=(unsigned int)-1) - glDeleteTextures(1, (GLuint*)&texname[2]);*/ + glDeleteTextures(1, (GLuint*)&texname[2]); } -void RAS_2DFilterManager::SetupTextures(bool depth, bool luminance, bool qrender, bool qdepth) +void RAS_2DFilterManager::SetupTextures(bool depth, bool luminance) { FreeTextures(); @@ -362,25 +321,6 @@ void RAS_2DFilterManager::SetupTextures(bool depth, bool luminance, bool qrender glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); } - - if(qrender){ - glGenTextures(1, (GLuint*)&texname[3]); - glBindTexture(GL_TEXTURE_2D, texname[3]); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, texturewidth/2, textureheight/2, 0, GL_RGBA8, - GL_UNSIGNED_BYTE, 0); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); - - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - - glGenFramebuffersEXT(1, &fbo); - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo); - glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, texname[3], 0); - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - } - } void RAS_2DFilterManager::UpdateOffsetMatrix(RAS_ICanvas* canvas) @@ -437,8 +377,6 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas) { bool need_depth=false; bool need_luminance=false; - bool need_qrender=false; - bool need_qdepth=false; int num_filters = 0; int passindex; @@ -454,11 +392,7 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas) need_depth = true; if(texflag[passindex] & 0x2) need_luminance = true; - if(texflag[passindex] & 0x4) - need_qrender = true; - if(texflag[passindex] & 0x8) - need_qdepth = true; - if(need_depth && need_luminance && need_qrender && need_qdepth) + if(need_depth && need_luminance) break; } } @@ -478,7 +412,7 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas) if(need_tex_update) { - SetupTextures(need_depth, need_luminance, need_qrender, need_qdepth); + SetupTextures(need_depth, need_luminance); need_tex_update = false; } @@ -494,12 +428,6 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas) glCopyTexImage2D(GL_TEXTURE_2D,0,GL_LUMINANCE16, 0, 0, texturewidth,textureheight, 0); } - if(need_qdepth){ - glActiveTextureARB(GL_TEXTURE4); - glBindTexture(GL_TEXTURE_2D, texname[4]); - glCopyTexImage2D(GL_TEXTURE_2D, 1, GL_DEPTH_COMPONENT, 0, 0, texturewidth, textureheight, 0); - } - glViewport(0,0, texturewidth, textureheight); glDisable(GL_DEPTH_TEST); @@ -520,53 +448,6 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas) glActiveTextureARB(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, texname[0]); glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 0, 0, texturewidth, textureheight, 0); - //glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, im_buff); - - if(need_qrender){ - //glActiveTextureARB(GL_TEXTURE3); - //glBindTexture(GL_TEXTURE_2D, texname[3]); - //glReadPixels(0, 0, texturewidth, textureheight, GL_RGB, GL_UNSIGNED_BYTE, im_buff); - //gluScaleImage(GL_RGB, texturewidth, textureheight, GL_UNSIGNED_BYTE, im_buff, - // texturewidth/2, textureheight/2, GL_UNSIGNED_BYTE, scaled_buff); - //glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, texturewidth, textureheight, GL_RGBA, GL_UNSIGNED_BYTE, im_buff); - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo); - if(glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) == GL_FRAMEBUFFER_COMPLETE_EXT) { - glPushAttrib(GL_VIEWPORT_BIT | GL_COLOR_BUFFER_BIT); - glViewport(0, 0, texturewidth/2, textureheight/2); - - /* glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glLoadIdentity(); - gluOrtho2D(0, texturewidth/2, 0, textureheight/2); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glLoadIdentity();*/ - glClearColor(0, 0, 0, 1); - - glClear(GL_COLOR_BUFFER_BIT); - /*glBindTexture(GL_TEXTURE_2D, texname[0]); - glBegin(GL_QUADS); - glColor4f(0.f, 1.f, 1.f, 1.f); - glTexCoord2f(1.f, 1.f); glVertex2f(1,1); - glTexCoord2f(0.f, 1.f); glVertex2f(-1,1); - glTexCoord2f(0.f, 0.f); glVertex2f(-1,-1); - glTexCoord2f(1.f, 0.f); glVertex2f(1,-1); - glEnd();*/ - - glFlush(); - //glPopMatrix(); - //glMatrixMode(GL_PROJECTION); - //glPopMatrix(); - - glPopAttrib(); - } else { - printf("Could not use the framebuffer\n"); - } - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - - } - - glClearColor(1, 0, 1, 1); glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_QUADS); diff --git a/source/gameengine/Rasterizer/RAS_2DFilterManager.h b/source/gameengine/Rasterizer/RAS_2DFilterManager.h index 2519473520a..7ff7cde7882 100644 --- a/source/gameengine/Rasterizer/RAS_2DFilterManager.h +++ b/source/gameengine/Rasterizer/RAS_2DFilterManager.h @@ -45,7 +45,7 @@ private: void EndShaderProgram(); void PrintShaderErrors(unsigned int shader, const char *task, const char *code); - void SetupTextures(bool depth, bool luminance, bool qrender, bool qdepth); + void SetupTextures(bool depth, bool luminance); void FreeTextures(); void UpdateOffsetMatrix(RAS_ICanvas* canvas); @@ -54,15 +54,13 @@ private: float canvascoord[4]; float textureoffsets[18]; float view[4]; - /* texname[0] contains render to texture, texname[1] contains depth texture, texname[2] contains luminance texture - * texname[3] contains quartered render to texture, texname[4] contains quartered depth texture*/ - unsigned int texname[5]; + /* texname[0] contains render to texture, texname[1] contains depth texture, texname[2] contains luminance texture*/ + unsigned int texname[3]; int texturewidth; int textureheight; int canvaswidth; int canvasheight; int numberoffilters; - unsigned int fbo; /* bit 0: enable/disable depth texture * bit 1: enable/disable luminance texture*/ short texflag[MAX_RENDER_PASS]; diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp index ec5f4c4ac6d..122a738e4f3 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp @@ -297,7 +297,6 @@ bool RAS_OpenGLRasterizer::BeginFrame(int drawingmode, double time) m_last_frontface = true; glShadeModel(GL_SMOOTH); - glEnable(GL_MULTISAMPLE_ARB); m_2DCanvas->BeginFrame(); @@ -383,7 +382,6 @@ void RAS_OpenGLRasterizer::EndFrame() FlushDebugLines(); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - glDisable(GL_MULTISAMPLE_ARB); m_2DCanvas->EndFrame(); } |