azul3d-legacy / gfx-gl2

gfx/gl2 package (moved to gfx repository)
Other
5 stars 1 forks source link

default shaders #1

Closed slimsag closed 10 years ago

slimsag commented 10 years ago

It would be nice if renderers could provide default shaders that work for most generic cases. The default shader should try to encapsulate all current examples such that no shader is needed.

This issue is a complaint from a user about not being able to use the graphics engine without explicitly writing GLSL shaders.

slimsag commented 10 years ago

According to Draw(r image.Rectangle, o *Object, c *Camera) at http://azul3d.org/gfx.v1#Canvas:

// The object will not be drawn if any of the following cases are true:
//  o.Shader == nil
//  len(o.Shader.Error) > 0
//  len(o.Meshes) == 0
//  !o.Meshes[N].Loaded && len(o.Meshes[N].Vertices) == 0

Meaning this would require a documentation change to azul3d/gfx -- which is okay, but for backwards compatibility guarantees we have to bump the version number up (silly for just this one thing).

Upon more thought into this issue -- the real truth is that:

See new issue for this at azul3d/examples#4

dskinner commented 10 years ago

I think that's a fine idea, plus many editors support glsl files. Maybe another idea for an example is dynamic reloading of a shader file via fsnotify.

It's actually kind of a touchy subject reloading a shader file depending on the editor used and how it "saves" a file, but the code isn't overly verbose and for someone learning shaders, having a way to edit the glsl file and see those changes immediately while running the program is a great learning tool.

slimsag commented 10 years ago

Maybe another idea for an example is dynamic reloading of a shader file via fsnotify.

Very interesting idea! Please create an issue for that at azul3d/issues as I would like to see that feature somewhere too, or even hear other's thoughts on it.