matus-chochlik / oglplus

OGLplus is a collection of open-source, cross-platform libraries which implement an object-oriented facade over the OpenGL® (version 3 and higher) and also OpenAL® (version 1.1) and EGL (version 1.4) C-language APIs. It provides wrappers which automate resource and object management and make the use of these libraries in C++ safer and more convenient.
http://oglplus.org/
Boost Software License 1.0
491 stars 72 forks source link

GLSLSource::FromFile: multiple kernel #97

Closed ucacaxm closed 9 years ago

ucacaxm commented 9 years ago

Sorry for the empty message.

As in OpenCL, CUDA or HLSL, I would like to write several compute shader in the same file. I know that GLSL does not allow this but I can do it by separating a text file into several string. For instance, each line with "#version 430 core" would the beginning of a new computer shader. Maybe I will add a pragma symbol with the name of the shader.

Just in case, I would like to know if this functionality is already possible with the class GLSLSource, maybe with the function Parts () ?

(if no, don"t worry, I will manage to do it easily).

Anyway, thanks for the great job in oglplus alex

matus-chochlik commented 9 years ago

Currently the GLSLSource::FromFile function loads the specified file as a single string so the Count function always returns 1 and Parts() returns the whole content of the file as a single string. Furthermore the GLSLSource class is intended to store the source of a single shader, so it can be used with glShaderSource; I don't think it would do good if the Parts() member function for some instances returned the sources of multiple shaders.

BR,

Matus