[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16792] branches/soc-2008-mxcurioni/source /blender/freestyle/intern: soc-2008-mxcurioni: imposed the glBlendEquation test accross all platforms ( providing greater robustness), introduced the FRS_glBlendEquation that uses glBlendEquation/ glBlendEquationEXT based on the system's capabilities.

Maxime Curioni maxime.curioni at gmail.com
Sun Sep 28 20:18:30 CEST 2008


Revision: 16792
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16792
Author:   mxcurioni
Date:     2008-09-28 20:18:30 +0200 (Sun, 28 Sep 2008)

Log Message:
-----------
soc-2008-mxcurioni: imposed the glBlendEquation test accross all platforms (providing greater robustness), introduced the FRS_glBlendEquation that uses glBlendEquation/glBlendEquationEXT based on the system's capabilities.

Modified Paths:
--------------
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppCanvas.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/rendering/GLStrokeRenderer.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/rendering/GLStrokeRenderer.h

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppCanvas.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppCanvas.cpp	2008-09-28 17:07:08 UTC (rev 16791)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppCanvas.cpp	2008-09-28 18:18:30 UTC (rev 16792)
@@ -19,17 +19,8 @@
 //
 ///////////////////////////////////////////////////////////////////////////////
 
+#include "../rendering/GLBlendEquation.h"
 
-#ifdef WIN32
-# include <GL/glew.h>
-# include <windows.h>
-#endif
-#ifdef __MACH__
-# include <OpenGL/gl.h>
-#else
-# include <GL/gl.h>
-#endif
-
 #include "AppGLWidget.h"
 #include "../image/Image.h"
 #include "../system/TimeStamp.h"
@@ -103,7 +94,7 @@
 
 void AppCanvas::init() 
 {
-#ifdef WIN32
+
   static bool firsttime = true;
   if (firsttime) {
 
@@ -112,15 +103,18 @@
 	{
 		cerr << "Error: problem occurred while initializing GLEW" << endl;	
 	}
-	cout << "GLEW initialized" << endl;
+	cout << "GLEW initialized: ";
 
-	if(!glBlendEquation) {
+	if(glBlendEquation) {
+		cout << "using glBlendEquation" << endl;
+	} else if(glBlendEquationEXT) {
+		cout << "using glBlendEquationEXT" << endl;
+	} else {
         _basic = true;
-        cout << "glBlendEquation unavailable on this hardware -> switching to strokes basic rendering mode" << endl;
+        cout << "glBlendEquation or glBlendEquationEXT unavailable on this hardware -> switching to strokes basic rendering mode" << endl;
      }
     firsttime=false;
    }
-#endif
 
   _Renderer = new GLStrokeRenderer;
   if(!StrokeRenderer::loadTextures())
@@ -258,12 +252,12 @@
   
   
   glDisable(GL_DEPTH_TEST);
-  glBlendEquation(GL_ADD);
+  FRS_glBlendEquation(GL_ADD);
   
   glBlendFunc(GL_DST_COLOR, GL_ZERO);
   
   glPushAttrib(GL_COLOR_BUFFER_BIT);
-  glBlendEquation(GL_FUNC_SUBTRACT);
+  FRS_glBlendEquation(GL_FUNC_SUBTRACT);
   glBlendFunc(GL_ONE, GL_ONE);
   
   glDisable(GL_TEXTURE_2D);
@@ -280,7 +274,7 @@
   glPopAttrib();
   
   glDisable(GL_DEPTH_TEST);
-  glBlendEquation(GL_ADD);
+  FRS_glBlendEquation(GL_ADD);
   glBlendFunc(GL_SRC_ALPHA, GL_ONE);
   
   glEnable(GL_TEXTURE_2D);
@@ -288,7 +282,7 @@
   Canvas::Render(iRenderer);
   //  
   glPushAttrib(GL_COLOR_BUFFER_BIT);
-  glBlendEquation(GL_FUNC_SUBTRACT);
+  FRS_glBlendEquation(GL_FUNC_SUBTRACT);
   glBlendFunc(GL_ONE, GL_ONE);
   
   glDisable(GL_TEXTURE_2D);

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/rendering/GLStrokeRenderer.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/rendering/GLStrokeRenderer.cpp	2008-09-28 17:07:08 UTC (rev 16791)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/rendering/GLStrokeRenderer.cpp	2008-09-28 18:18:30 UTC (rev 16792)
@@ -36,8 +36,6 @@
 
 #include "../system/StringUtils.h"
 
-//#define glBlendEquation(x)
-
 GLStrokeRenderer::GLStrokeRenderer()
 :StrokeRenderer()
 {
@@ -95,16 +93,16 @@
 
   if(strokeType==Stroke::DRY_MEDIUM)
     {
-      glBlendEquation(GL_MAX);
+      FRS_glBlendEquation(GL_MAX);
     }
   else if(strokeType==Stroke::OPAQUE_MEDIUM)
     {
-      glBlendEquation(GL_ADD);
+      FRS_glBlendEquation(GL_ADD);
       glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
     }
   else
     {
-      glBlendEquation(GL_ADD);
+      FRS_glBlendEquation(GL_ADD);
       glBlendFunc(GL_SRC_ALPHA, GL_ONE);
     }
   glEnable(GL_TEXTURE_2D);

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/rendering/GLStrokeRenderer.h
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/rendering/GLStrokeRenderer.h	2008-09-28 17:07:08 UTC (rev 16791)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/rendering/GLStrokeRenderer.h	2008-09-28 18:18:30 UTC (rev 16792)
@@ -34,17 +34,8 @@
 # include "../stroke/StrokeRenderer.h"
 # include "../stroke/StrokeRep.h"
 
+#include "GLBlendEquation.h"
 
-#ifdef WIN32
-# include <GL/glew.h>
-# include <windows.h>
-#endif
-#ifdef __MACH__
-# include <OpenGL/gl.h>
-#else
-# include <GL/gl.h>
-#endif
-
 /**********************************/
 /*                                */
 /*                                */





More information about the Bf-blender-cvs mailing list