forked from bartvdbraak/blender
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.
This commit is contained in:
parent
26709ce90c
commit
5812c494a5
@ -19,16 +19,7 @@
|
|||||||
//
|
//
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#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 "AppGLWidget.h"
|
||||||
#include "../image/Image.h"
|
#include "../image/Image.h"
|
||||||
@ -103,7 +94,7 @@ void AppCanvas::preDraw()
|
|||||||
|
|
||||||
void AppCanvas::init()
|
void AppCanvas::init()
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
|
||||||
static bool firsttime = true;
|
static bool firsttime = true;
|
||||||
if (firsttime) {
|
if (firsttime) {
|
||||||
|
|
||||||
@ -112,15 +103,18 @@ void AppCanvas::init()
|
|||||||
{
|
{
|
||||||
cerr << "Error: problem occurred while initializing GLEW" << endl;
|
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;
|
_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;
|
firsttime=false;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
_Renderer = new GLStrokeRenderer;
|
_Renderer = new GLStrokeRenderer;
|
||||||
if(!StrokeRenderer::loadTextures())
|
if(!StrokeRenderer::loadTextures())
|
||||||
@ -258,12 +252,12 @@ void AppCanvas::Render(const StrokeRenderer *iRenderer)
|
|||||||
|
|
||||||
|
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
glBlendEquation(GL_ADD);
|
FRS_glBlendEquation(GL_ADD);
|
||||||
|
|
||||||
glBlendFunc(GL_DST_COLOR, GL_ZERO);
|
glBlendFunc(GL_DST_COLOR, GL_ZERO);
|
||||||
|
|
||||||
glPushAttrib(GL_COLOR_BUFFER_BIT);
|
glPushAttrib(GL_COLOR_BUFFER_BIT);
|
||||||
glBlendEquation(GL_FUNC_SUBTRACT);
|
FRS_glBlendEquation(GL_FUNC_SUBTRACT);
|
||||||
glBlendFunc(GL_ONE, GL_ONE);
|
glBlendFunc(GL_ONE, GL_ONE);
|
||||||
|
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
@ -280,7 +274,7 @@ void AppCanvas::Render(const StrokeRenderer *iRenderer)
|
|||||||
glPopAttrib();
|
glPopAttrib();
|
||||||
|
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
glBlendEquation(GL_ADD);
|
FRS_glBlendEquation(GL_ADD);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||||
|
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
@ -288,7 +282,7 @@ void AppCanvas::Render(const StrokeRenderer *iRenderer)
|
|||||||
Canvas::Render(iRenderer);
|
Canvas::Render(iRenderer);
|
||||||
//
|
//
|
||||||
glPushAttrib(GL_COLOR_BUFFER_BIT);
|
glPushAttrib(GL_COLOR_BUFFER_BIT);
|
||||||
glBlendEquation(GL_FUNC_SUBTRACT);
|
FRS_glBlendEquation(GL_FUNC_SUBTRACT);
|
||||||
glBlendFunc(GL_ONE, GL_ONE);
|
glBlendFunc(GL_ONE, GL_ONE);
|
||||||
|
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
@ -36,8 +36,6 @@ extern "C" {
|
|||||||
|
|
||||||
#include "../system/StringUtils.h"
|
#include "../system/StringUtils.h"
|
||||||
|
|
||||||
//#define glBlendEquation(x)
|
|
||||||
|
|
||||||
GLStrokeRenderer::GLStrokeRenderer()
|
GLStrokeRenderer::GLStrokeRenderer()
|
||||||
:StrokeRenderer()
|
:StrokeRenderer()
|
||||||
{
|
{
|
||||||
@ -95,16 +93,16 @@ void GLStrokeRenderer::RenderStrokeRep(StrokeRep *iStrokeRep) const
|
|||||||
|
|
||||||
if(strokeType==Stroke::DRY_MEDIUM)
|
if(strokeType==Stroke::DRY_MEDIUM)
|
||||||
{
|
{
|
||||||
glBlendEquation(GL_MAX);
|
FRS_glBlendEquation(GL_MAX);
|
||||||
}
|
}
|
||||||
else if(strokeType==Stroke::OPAQUE_MEDIUM)
|
else if(strokeType==Stroke::OPAQUE_MEDIUM)
|
||||||
{
|
{
|
||||||
glBlendEquation(GL_ADD);
|
FRS_glBlendEquation(GL_ADD);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
glBlendEquation(GL_ADD);
|
FRS_glBlendEquation(GL_ADD);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||||
}
|
}
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
@ -34,16 +34,7 @@
|
|||||||
# include "../stroke/StrokeRenderer.h"
|
# include "../stroke/StrokeRenderer.h"
|
||||||
# include "../stroke/StrokeRep.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
|
|
||||||
|
|
||||||
/**********************************/
|
/**********************************/
|
||||||
/* */
|
/* */
|
||||||
|
Loading…
Reference in New Issue
Block a user