/** * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. The Blender * Foundation also sells licenses for use in proprietary software under * the Blender License. See http://www.blender.org/BL/ for information * about this. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. * * The Original Code is: all of this file. * * Contributor(s): none yet. * * ***** END GPL LICENSE BLOCK ***** */ #define STRINGIFY(A) #A #include "RAS_OpenGLFilters/RAS_Blur2DFilter.h" #include "RAS_OpenGLFilters/RAS_Sharpen2DFilter.h" #include "RAS_OpenGLFilters/RAS_Dilation2DFilter.h" #include "RAS_OpenGLFilters/RAS_Erosion2DFilter.h" #include "RAS_OpenGLFilters/RAS_Laplacian2DFilter.h" #include "RAS_OpenGLFilters/RAS_Sobel2DFilter.h" #include "RAS_OpenGLFilters/RAS_Prewitt2DFilter.h" #include "RAS_OpenGLFilters/RAS_GrayScale2DFilter.h" #include "RAS_OpenGLFilters/RAS_Sepia2DFilter.h" #include "RAS_OpenGLFilters/RAS_Invert2DFilter.h" #include "STR_String.h" #include "RAS_ICanvas.h" #include "RAS_2DFilterManager.h" #include #ifdef WIN32 // OpenGL gl.h needs 'windows.h' on windows platforms #include #endif //WIN32 #ifdef __APPLE__ #define GL_GLEXT_LEGACY 1 #include #else #include #endif #include "RAS_OpenGLRasterizer/RAS_GLExtensionManager.h" #ifdef HAVE_CONFIG_H #include #endif RAS_2DFilterManager::RAS_2DFilterManager(): texturewidth(-1), textureheight(-1), canvaswidth(-1), canvasheight(-1), numberoffilters(0),texname(-1) { isshadersupported = bgl::QueryVersion(2,0); if(!isshadersupported) { std::cout<<"shaders not supported!" << std::endl; return; } int passindex; for(passindex =0; passindexGetWidth() || canvasheight != canvas->GetHeight()) { UpdateOffsetMatrix(canvas->GetWidth(), canvas->GetHeight()); } GLuint viewport[4]={0}; int passindex; bool first = true; for(passindex =0; passindex=MAX_RENDER_PASS) return; if(mode == RAS_2DFILTER_DISABLED) { m_enabled[pass] = 0; return; } if(mode == RAS_2DFILTER_ENABLED) { m_enabled[pass] = 1; return; } if(mode == RAS_2DFILTER_NOFILTER) { if(m_filters[pass]) bgl::blDeleteObjectARB(m_filters[pass]); m_enabled[pass] = 0; m_filters[pass] = 0; return; } if(mode == RAS_2DFILTER_CUSTOMFILTER) { if(m_filters[pass]) bgl::blDeleteObjectARB(m_filters[pass]); m_filters[pass] = CreateShaderProgram(text.Ptr()); m_enabled[pass] = 1; return; } if(mode>=RAS_2DFILTER_MOTIONBLUR && mode<=RAS_2DFILTER_INVERT) { if(m_filters[pass]) bgl::blDeleteObjectARB(m_filters[pass]); m_filters[pass] = CreateShaderProgram(mode); m_enabled[pass] = 1; } #endif }