Kaydet (Commit) 6be20258 authored tarafından Zolnai Tamás's avatar Zolnai Tamás

libgltf: check for #version string in the shader before add an own one.

Change-Id: I69dbbabc5774cbce7943e77f41bb42ed7a118bcf
üst e3794016
diff -ur libgltf.org/src/Shaders.cpp libgltf/src/Shaders.cpp
--- libgltf.org/src/Shaders.cpp 2014-08-17 09:15:17.379255115 +0200
+++ libgltf/src/Shaders.cpp 2014-08-17 09:16:43.323258781 +0200
--- libgltf.org/src/Shaders.cpp 2014-08-18 09:19:48.323955939 +0200
+++ libgltf/src/Shaders.cpp 2014-08-18 09:20:46.711953465 +0200
@@ -11,6 +11,7 @@
#include <GL/glew.h>
......@@ -9,11 +9,13 @@ diff -ur libgltf.org/src/Shaders.cpp libgltf/src/Shaders.cpp
namespace libgltf
{
@@ -166,7 +167,17 @@
@@ -166,7 +167,24 @@
unsigned int shaderId)
{
GLint iGLSize = iSize;
- glShaderSource(shaderId, 1, &pShader, &iGLSize);
+ if( strstr(pShader,"#version") == 0 )
+ {
+ const GLchar* aSources[] = {
+ "#version 130\n",
+ pShader,
......@@ -25,6 +27,11 @@ diff -ur libgltf.org/src/Shaders.cpp libgltf/src/Shaders.cpp
+ };
+
+ glShaderSource(shaderId, 2, &aSources[0], &aSizes[0]);
+ }
+ else
+ {
+ glShaderSource(shaderId, 1, &pShader, &iGLSize);
+ }
glCompileShader(shaderId);
int iStatus = 0;
glGetShaderiv(shaderId, GL_COMPILE_STATUS, &iStatus);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment