aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/Graphics/Shader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libjin/Graphics/Shader.cpp')
-rw-r--r--src/libjin/Graphics/Shader.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/libjin/Graphics/Shader.cpp b/src/libjin/Graphics/Shader.cpp
index ae64c7e..7f849a6 100644
--- a/src/libjin/Graphics/Shader.cpp
+++ b/src/libjin/Graphics/Shader.cpp
@@ -3,11 +3,14 @@
#include "../utils/macros.h"
#include "Shader.h"
+#include "../Filesystem/Buffer.h"
namespace jin
{
namespace graphics
{
+ using namespace jin::filesystem;
+
#include "base.shader.h"
/*
@@ -55,11 +58,10 @@ namespace graphics
: currentTextureUnit(DEFAULT_TEXTURE_UNIT)
{
int size = strlen(program) + SHADER_FORMAT_SIZE;
- char* fs = (char*)alloca(size);
- memset(fs, 0, size);
- formatShader(fs, program);
+ Buffer b = Buffer(size);
+ formatShader((char*)b.data, program);
GLuint shader = glCreateShader(GL_FRAGMENT_SHADER);
- glShaderSource(shader, 1, (const GLchar**)&fs, NULL);
+ glShaderSource(shader, 1, (const GLchar**)&b.data, NULL);
glCompileShader(shader);
GLint success;
glGetShaderiv(shader, GL_COMPILE_STATUS, &success);