Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2013-08-31 03:49:35 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2013-08-31 03:49:35 +0400
commit60ff60dcdc9f43891fb8a19e10f9bb7964a539bf (patch)
treeced8e2887295b713d67dfd496728703c71f53442 /intern/opencolorio
parent6785874e7adf5ef15e7a28b134b2bd4e8b3a8988 (diff)
RenderEngine API: add viewport draw utility functions to bind a GLSL fragment
shader for converting colors from linear to display space, based on the scene color management settings. if engine.support_display_space_shader(scene): # test graphics card support engine.bind_display_space_shader(scene) # draw pixels .. engine.unbind_display_space_shader()
Diffstat (limited to 'intern/opencolorio')
-rw-r--r--intern/opencolorio/fallback_impl.cc5
-rw-r--r--intern/opencolorio/ocio_capi.cc5
-rw-r--r--intern/opencolorio/ocio_capi.h1
-rw-r--r--intern/opencolorio/ocio_impl.h3
-rw-r--r--intern/opencolorio/ocio_impl_glsl.cc12
5 files changed, 21 insertions, 5 deletions
diff --git a/intern/opencolorio/fallback_impl.cc b/intern/opencolorio/fallback_impl.cc
index 37f624e1f8b..9d6561fb4cb 100644
--- a/intern/opencolorio/fallback_impl.cc
+++ b/intern/opencolorio/fallback_impl.cc
@@ -381,6 +381,11 @@ void FallbackImpl::matrixTransformScale(float * , float * , const float *)
{
}
+bool FallbackImpl::supportGLSLDraw(void)
+{
+ return false;
+}
+
bool FallbackImpl::setupGLSLDraw(struct OCIO_GLSLDrawState **state_r, OCIO_ConstProcessorRcPtr *processor, bool predivide)
{
return false;
diff --git a/intern/opencolorio/ocio_capi.cc b/intern/opencolorio/ocio_capi.cc
index c8db2c2b531..49f8d2ca41e 100644
--- a/intern/opencolorio/ocio_capi.cc
+++ b/intern/opencolorio/ocio_capi.cc
@@ -283,6 +283,11 @@ void OCIO_matrixTransformScale(float * m44, float * offset4, const float *scale4
impl->matrixTransformScale(m44, offset4, scale4f);
}
+int OCIO_supportGLSLDraw(void)
+{
+ return (int) impl->supportGLSLDraw();
+}
+
int OCIO_setupGLSLDraw(struct OCIO_GLSLDrawState **state_r, OCIO_ConstProcessorRcPtr *processor, int predivide)
{
return (int) impl->setupGLSLDraw(state_r, processor, (bool) predivide);
diff --git a/intern/opencolorio/ocio_capi.h b/intern/opencolorio/ocio_capi.h
index 3632a0da1c6..0b3102a290d 100644
--- a/intern/opencolorio/ocio_capi.h
+++ b/intern/opencolorio/ocio_capi.h
@@ -121,6 +121,7 @@ void OCIO_matrixTransformRelease(OCIO_MatrixTransformRcPtr *mt);
void OCIO_matrixTransformScale(float * m44, float * offset4, const float * scale4);
+int OCIO_supportGLSLDraw(void);
int OCIO_setupGLSLDraw(struct OCIO_GLSLDrawState **state_r, OCIO_ConstProcessorRcPtr *processor, int predivide);
void OCIO_finishGLSLDraw(struct OCIO_GLSLDrawState *state);
void OCIO_freeOGLState(struct OCIO_GLSLDrawState *state);
diff --git a/intern/opencolorio/ocio_impl.h b/intern/opencolorio/ocio_impl.h
index a328470ccb5..a1e743bf2f6 100644
--- a/intern/opencolorio/ocio_impl.h
+++ b/intern/opencolorio/ocio_impl.h
@@ -96,6 +96,7 @@ public:
virtual void matrixTransformScale(float * m44, float * offset4, const float * scale4) = 0;
+ virtual bool supportGLSLDraw(void) = 0;
virtual bool setupGLSLDraw(struct OCIO_GLSLDrawState **state_r, OCIO_ConstProcessorRcPtr *processor, bool predivide) = 0;
virtual void finishGLSLDraw(struct OCIO_GLSLDrawState *state) = 0;
virtual void freeGLState(struct OCIO_GLSLDrawState *state_r) = 0;
@@ -169,6 +170,7 @@ public:
void matrixTransformScale(float * m44, float * offset4, const float * scale4);
+ bool supportGLSLDraw(void);
bool setupGLSLDraw(struct OCIO_GLSLDrawState **state_r, OCIO_ConstProcessorRcPtr *processor, bool predivide);
void finishGLSLDraw(struct OCIO_GLSLDrawState *state);
void freeGLState(struct OCIO_GLSLDrawState *state_r);
@@ -243,6 +245,7 @@ public:
void matrixTransformScale(float * m44, float * offset4, const float * scale4);
+ bool supportGLSLDraw(void);
bool setupGLSLDraw(struct OCIO_GLSLDrawState **state_r, OCIO_ConstProcessorRcPtr *processor, bool predivide);
void finishGLSLDraw(struct OCIO_GLSLDrawState *state);
void freeGLState(struct OCIO_GLSLDrawState *state_r);
diff --git a/intern/opencolorio/ocio_impl_glsl.cc b/intern/opencolorio/ocio_impl_glsl.cc
index 54be1e0f339..1a3132fa4b3 100644
--- a/intern/opencolorio/ocio_impl_glsl.cc
+++ b/intern/opencolorio/ocio_impl_glsl.cc
@@ -36,12 +36,7 @@
#include <sstream>
#include <string.h>
-#ifdef __APPLE__
-#include <OpenGL/gl.h>
-#include <OpenGL/glu.h>
-#else
#include <GL/glew.h>
-#endif
#include <OpenColorIO/OpenColorIO.h>
@@ -202,6 +197,13 @@ static bool ensureLUT3DAllocated(OCIO_GLSLDrawState *state)
return state->lut3d_texture_valid;
}
+/* Detect if we can support GLSL drawing */
+bool OCIOImpl::supportGLSLDraw()
+{
+ /* GLSL and GL_RGB16F_ARB */
+ return GLEW_VERSION_2_0 && (GLEW_VERSION_3_0 || GLEW_ARB_texture_float);
+}
+
/**
* Setup OpenGL contexts for a transform defined by processor using GLSL
* All LUT allocating baking and shader compilation happens here.