Basic shader example

Hello forum,

I am going through the basic shader example and i found that you are not sending the modelviewprojection matrix specifically as uniform while calling the command

font.drawStringAsShapes(....);

Are you sending it behind the scene ?

Inside the vertex shader file you did indeed declared the uniform variable though.

uniform mat4 modelViewProjectionMatrix;

Thanks

yes when using the programmable renderer openframeworks uploads the current modelView and projection matrices (and the modelViewProjection) internally every frame and every time you bind a shader. you can load your own using ofLoadMatrix() or just use the uniforms directly if you prefer

1 Like

Thanks !

Now i am trying one of the shaders and getting the following error:

[ error ] ofShader: begin(): couldn't begin, shader not loaded

I am trying to load the shaders with the following snippet:

void ofApp::setup(){

if(ofIsGLProgrammableRenderer())
shader.load(“shader/shader.vert”,“shader/shader.frag”);
else
{
std::cout << "Programmable Shading is not supported. " << std::endl;
exit();
}
}

And the shaders files are located inside the bin/data/shader/ .

What am i missing in the process ?

The issue is solved.

Thanks