Skip to content
/ cppglsl Public

C++11 implementation of vec2, vec3, vec4, mat2, mat3, mat4 and sampler2D with swizzeling.

License

Notifications You must be signed in to change notification settings

983/cppglsl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This project is dead. A glsl to cpp compiler looks like a more promissing approach.

cppglsl

C++11 implementation of vec2, vec3, vec4, mat2, mat3, mat4, sampler2D with swizzeling.

Example output of fragment shader executed on the CPU:

Example

Why:

Many examples on https://www.shadertoy.com/ and http:https://glslsandbox.com/ only display black on older gpus. With this library most examples can simply be copied and pasted into c++ files and work correctly without modifications.

Another nice thing is debugging since now you can simply add a printf call into your shader.

Example:

void main(){
    vec2 uv = gl_FragCoord.xy / iResolution.xy;
    uv -= iMouse.xy / iResolution.xy;
    printf("%f %f\n", uv.x, uv.y);
    gl_FragColor = texture2D(iChannel0, uv);
}

Limitations:

  • out and inout can not be converted to references with macros. Use the fix_inout.py script for that.
  • Swizzled members can not be used as out or inout parameters.
  • dFdx, dFdy and fwidth are not supported.

About

C++11 implementation of vec2, vec3, vec4, mat2, mat3, mat4 and sampler2D with swizzeling.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published