I want to define the perspective matrix for the programmable pipeline. I found that there is a function called setupScreenPerspective() inside the ofGLProgrammableRenderer . But i believe that you have create a object of type
ofGLProgrammableRenderer to use the function. I am a bit confused here. I am using the following snippet to enable the programmable pipeline:
// comment out the line below if you want to use a fixed pipeline opengl renderer,
// otherwise leave this line uncommented if you want to use a programmable pipeline opengl renderer.
int main( )
ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context
// this kicks off the running of my app
// can be OF_WINDOW or OF_FULLSCREEN
// pass in width and height too:
According to the example , it did not create any object of that type .
I want to define the projection matrix from the application that will be sent to the shader of programmable pipeline.
Without the object definition i end up with the following error:
src/ofApp.cpp: In member function ‘virtual void ofApp::draw()’:
src/ofApp.cpp:80:97: error: cannot call member function ‘virtual void ofGLProgrammableRenderer::setupScreenPerspective(float, float, float, float, float)’ without object
src/ofApp.cpp:72:10: warning: unused variable ‘f’ [-Wunused-variable]
make: *** [obj/linux/Release/src/ofApp.o] Error 1
I could be wrong, but since it’s not a static funtion, you can only call it as a member function, so you would need an object indeed. And I don’t know if this is “good practice” because OF uses already a renderer object (in this case ofProgrammableRenderer) under the hood to take care of everything.
you shouldn’t be using the renderer directly, it’s an object that openframeworks creates and uses internally, most functions in the renderers are available from the functions in ofGraphics, in this case through ofSetupPerspective()