Ogre Version: : 1 12 13:
Operating System: :Linux Tumbleweed:
Render System: :OpenGL3+:
Hello, hello, I try to manually tinker toy with shaders. Manually means I do createMaterial on the fly and then pinpoint the vertex and fragment programs, without the need of material scripts ( I would need that later ) . I almost managed to write my first pass-through vertex program, well almost :
I do :
Code: Select all
myOutliner = Ogre::MaterialManager::getSingletonPtr()->create("myOutliner", "Graphics");
Ogre::HighLevelGpuProgramManager& mgr = Ogre::HighLevelGpuProgramManager::getSingleton();
Ogre::HighLevelGpuProgramPtr vertex_program = mgr.createProgram("enlarge", "Graphics","glsl" ,Ogre::GpuProgramType::GPT_VERTEX_PROGRAM);
Ogre::GpuProgramParametersSharedPtr vertexParams = vertex_program->createParameters();
vertexParams->setNamedAutoConstant("worldViewProj", Ogre::GpuProgramParameters::ACT_WORLDVIEWPROJ_MATRIX);
vertex_program->setSourceFile("enlarge.vert");
Code: Select all
#version 330 core
#extension GL_ARB_explicit_uniform_location : enable
#extension GL_ARB_shading_language_include : enable
layout (location = 0) in vec4 position;
uniform mat4 worldViewProj;
void main(void)
{
gl_Position =worldViewProj * position;
}
I get:
Code: Select all
Program 'enlarge' is not supported: Failed to preprocess shader enlarge
(20:31:15) (ODApplication) [NORMAL] InvalidParametersException: Named constants have not been initialised, perhaps a compile error in _findNamedConstantDefinition at /home/tom/Downloads/ogre-1.12.13/OgreMain/src/OgreGpuProgramParams.cpp (line 1675)
What I do wrong here ? For sure something wrong with the way I feed the namedAutoConstant parameteres but why it is so ?