diff options
Diffstat (limited to 'src/libjin/Graphics')
-rw-r--r-- | src/libjin/Graphics/Canvas.h | 2 | ||||
-rw-r--r-- | src/libjin/Graphics/Color.h | 10 | ||||
-rw-r--r-- | src/libjin/Graphics/Shader.cpp | 10 |
3 files changed, 16 insertions, 6 deletions
diff --git a/src/libjin/Graphics/Canvas.h b/src/libjin/Graphics/Canvas.h index ec94d28..2522d32 100644 --- a/src/libjin/Graphics/Canvas.h +++ b/src/libjin/Graphics/Canvas.h @@ -31,4 +31,4 @@ namespace graphics } // jin #endif // LIBJIN_MODULES_RENDER -#endif // __LIBJIN_CANVAS_H +#endif // __LIBJIN_CANVAS_H
\ No newline at end of file diff --git a/src/libjin/Graphics/Color.h b/src/libjin/Graphics/Color.h index 4d78706..170ee0b 100644 --- a/src/libjin/Graphics/Color.h +++ b/src/libjin/Graphics/Color.h @@ -16,7 +16,7 @@ namespace graphics class Color { public: - /* Default Colors */ + /* Built-in Colors */ static const Color WHITE; static const Color BLACK; static const Color RED; @@ -45,6 +45,14 @@ namespace graphics a = c.a; } + void operator = (const Color& c) + { + r = c.r; + g = c.g; + b = c.b; + a = c.a; + } + bool operator == (const Color& c) { return r == c.r && g == c.g && b == c.b && a == c.a; 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); |