Skip to content

Introduce a shader program wrapper to enable dynamic editing of shaders at runtime

Notifications You must be signed in to change notification settings

haehnpt/opengl-dynamic-shader-editing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

opengl-dynamic-shader-editing

This Shader Program Wrapper enables the user to dynamically edit shaders at runtime. It can be either used for debugging shaders or while presenting the effects of changes to the shader code.

Note

Tested with GLFW and GLAD. Header file might have to be modified to fit your project.

How to use

  1. Initialize the Shader Program Wrapper with a Vertex Shader and a Fragment Shader:
ShaderProgramWrapper spw("shaders/vertex_shader.shader", 
  "shaders/fragment_shader.shader", 
  true);

If the last parameter is set to false, the shader files will not be watched.

  1. Use the underlying Shader Program to render:
spw.UseShaderProgram();
  1. You can edit the shader files at runtime and changes will apply after saving.

Impressions

Window, console and fragment shader which is ready to be edited: 1

Saving with errors in the shader does show them in the console: 2

Saving without errors in the shader yields the expected results: 3

About

Introduce a shader program wrapper to enable dynamic editing of shaders at runtime

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages