|
|
|
|
|
by glassx
4143 days ago
|
|
Another useful OpenGL macro, at least for me, is this one: #define GLSL(str) (char*)"#version 330\n" #str
It basically enables you to embed quick snippets of GLSL inside your C code, instead of using concatenated strings. Example: char* fragShader = GLSL(
in vec3 uv;
out vec4 color;
uniform sampler2DArray tex;
void main()
{
// Comments work too
color = texture(tex, uv);
}
);
In Sublime Text you even get code completion and color highlighting, since GLSL and C look so alike.I believe it might work for OpenCL Kernels too. The only downside is that it doesn't add line breaks by itself (hence the "#version 330\n", which requires a line break), so GLSL Compilation errors aren't as useful. (Source: https://open.gl/geometry ) |
|