class methods
- ofGLProgrammableRenderer()
- background()
- begin()
- bind()
- bindForBlitting()
- clear()
- clearAlpha()
- defaultFragmentShaderHeader()
- defaultVertexShaderHeader()
- disableAlphaMask()
- disableAntiAliasing()
- disableLight()
- disableLighting()
- disablePointSprites()
- disableSeparateSpecularLight()
- disableTextureTarget()
- draw()
- drawCircle()
- drawElements()
- drawElementsInstanced()
- drawEllipse()
- drawInstanced()
- drawLine()
- drawRectangle()
- drawString()
- drawTriangle()
- enableAntiAliasing()
- enableLight()
- enableLighting()
- enablePointSprites()
- enableSeparateSpecularLight()
- enableTextureTarget()
- end()
- finishRender()
- get3dGraphics()
- getBackgroundAuto()
- getBackgroundColor()
- getCoordHandedness()
- getCurrentMatrix()
- getCurrentNormalMatrix()
- getCurrentOrientationMatrix()
- getCurrentShader()
- getCurrentTextureTarget()
- getCurrentViewMatrix()
- getCurrentViewport()
- getFillMode()
- getGLVersionMajor()
- getGLVersionMinor()
- getLightingEnabled()
- getNativeViewport()
- getPath()
- getRectMode()
- getStyle()
- getType()
- getVideoShader()
- getViewportHeight()
- getViewportWidth()
- isVFlipped()
- loadIdentityMatrix()
- loadMatrix()
- loadViewMatrix()
- matrixMode()
- multMatrix()
- multViewMatrix()
- popMatrix()
- popStyle()
- popView()
- pushMatrix()
- pushStyle()
- pushView()
- rotateRad()
- rotateXRad()
- rotateYRad()
- rotateZRad()
- saveFullViewport()
- saveScreen()
- scale()
- setAlphaMaskTex()
- setBackgroundAuto()
- setBackgroundColor()
- setBitmapTextMode()
- setBlendMode()
- setCircleResolution()
- setColor()
- setCoordHandedness()
- setCurveResolution()
- setDepthTest()
- setFillMode()
- setGlobalAmbientColor()
- setHexColor()
- setLightAmbientColor()
- setLightAttenuation()
- setLightDiffuseColor()
- setLightPosition()
- setLightSpecularColor()
- setLightSpotConcentration()
- setLightSpotDirection()
- setLightSpotlightCutOff()
- setLineSmoothing()
- setLineWidth()
- setOrientation()
- setPolyMode()
- setRectMode()
- setSmoothLighting()
- setStyle()
- setVideoShaderUniforms()
- setup()
- setupGraphicDefaults()
- setupScreen()
- setupScreenOrtho()
- setupScreenPerspective()
- startRender()
- translate()
- unbind()
- viewport()
variables
Extends
This class extends others, you can call their methods on an instance of ofGLProgrammableRenderer too:
The OpenGL programable renderer is a renderer for OF that is built specifically to support both newer versions of OpenGL (3+) as well as supporting GLES, which is what you'll be using if you're running OF on an ARM Linux (i.e. Raspberry Pi), Android, or iOS device. There are a few key differences between OpenGL 3 and OpenGL 2 that are largely hidden from you by OF. You can still use the same methods for drawing, making meshes, uploading textures, and other drawing operations on the programmable renderer as you could on the direct pipeline, so you're not missing anything if you stick to the older pipeline. The most significant difference probably comes in writing GLSL shaders, since the syntax changes between the older implementation and the newer. One of the important things that the ofGLProgrammableRenderer adds is default shaders. That's right: every time you run your OF application, shaders are created and uploaded to the GPU without you even knowing it. There's also addition parameters that are automatically passed to the shader program that you can leverage if you're writing your own. Check out this chapter about OpenGL in the ofBook and this blog post for more information on using different OpenGL versions.
To initialize the ofGLProgrammableRenderer call ofSetCurrentRenderer() before you call ofSetupOpenGL() in your main.cpp file:
// say that we're going to *use* the fancy new renderer
ofSetCurrentRenderer(ofGLProgrammableRenderer::TYPE);
ofSetupOpenGL(1024,768, OF_WINDOW); // <-------- setup the GL context
After that, things should remain the same for you whether you're using the older ofGLRenderer or the newer ofGLProgrammableRenderer.
Alternatively, in openFrameworks 0.9 you can directly set the OpenGL version as follows:
// main.cpp (openFrameworks 0.9)
int main(){
ofGLWindowSettings settings;
settings.setGLVersion(4,5); /// < select your GL Version here
ofCreateWindow(settings); ///< create your window here
ofRunApp(new ofApp());
}
ofGLProgrammableRenderer(...)
ofGLProgrammableRenderer::ofGLProgrammableRenderer(const ofAppBaseWindow *window)
bindForBlitting(...)
void ofGLProgrammableRenderer::bindForBlitting(const ofFbo &fboSrc, ofFbo &fboDst, int attachmentPoint)
defaultFragmentShaderHeader(...)
string ofGLProgrammableRenderer::defaultFragmentShaderHeader(GLenum textureTarget)
defaultVertexShaderHeader(...)
string ofGLProgrammableRenderer::defaultVertexShaderHeader(GLenum textureTarget)
disableTextureTarget(...)
void ofGLProgrammableRenderer::disableTextureTarget(int textureTarget, int textureLocation)
draw(...)
void ofGLProgrammableRenderer::draw(const of3dPrimitive &model, ofPolyRenderMode renderType)
draw(...)
void ofGLProgrammableRenderer::draw(const ofBaseVideoDraws &video, float x, float y, float w, float h)
draw(...)
void ofGLProgrammableRenderer::draw(const ofFloatImage &image, float x, float y, float z, float w, float h, float sx, float sy, float sw, float sh)
draw(...)
void ofGLProgrammableRenderer::draw(const ofImage &image, float x, float y, float z, float w, float h, float sx, float sy, float sw, float sh)
draw(...)
void ofGLProgrammableRenderer::draw(const ofMesh &vertexData, ofPolyRenderMode renderType, bool useColors, bool useTextures, bool useNormals)
draw(...)
void ofGLProgrammableRenderer::draw(const ofShortImage &image, float x, float y, float z, float w, float h, float sx, float sy, float sw, float sh)
draw(...)
void ofGLProgrammableRenderer::draw(const ofTexture &image, float x, float y, float z, float w, float h, float sx, float sy, float sw, float sh)
draw(...)
void ofGLProgrammableRenderer::draw(const ofVbo &vbo, GLuint drawMode, int first, int total)
drawElements(...)
void ofGLProgrammableRenderer::drawElements(const ofVbo &vbo, GLuint drawMode, int amt, int offsetelements=0)
drawElementsInstanced(...)
void ofGLProgrammableRenderer::drawElementsInstanced(const ofVbo &vbo, GLuint drawMode, int amt, int primCount)
drawEllipse(...)
void ofGLProgrammableRenderer::drawEllipse(float x, float y, float z, float width, float height)
drawInstanced(...)
void ofGLProgrammableRenderer::drawInstanced(const ofVbo &vbo, GLuint drawMode, int first, int total, int primCount)
drawInstanced(...)
void ofGLProgrammableRenderer::drawInstanced(const ofVboMesh &mesh, ofPolyRenderMode renderType, int primCount)
drawLine(...)
void ofGLProgrammableRenderer::drawLine(float x1, float y1, float z1, float x2, float y2, float z2)
drawRectangle(...)
void ofGLProgrammableRenderer::drawRectangle(float x, float y, float z, float w, float h)
drawString(...)
void ofGLProgrammableRenderer::drawString(const ofTrueTypeFont &font, string text, float x, float y)
drawTriangle(...)
void ofGLProgrammableRenderer::drawTriangle(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3)
enableTextureTarget(...)
void ofGLProgrammableRenderer::enableTextureTarget(const ofTexture &tex, int textureLocation)
getCurrentMatrix(...)
glm::mat4 ofGLProgrammableRenderer::getCurrentMatrix(ofMatrixMode matrixMode_)
Documentation from code comments
Queries the current OpenGL matrix state
Returns the specified matrix as held by the renderer's current matrix stack.
You can query one of the following:
[OF_MATRIX_MODELVIEW | OF_MATRIX_PROJECTION | OF_MATRIX_TEXTURE]
Each query will return the state of the matrix as it was uploaded to the shader currently bound.
\param matrixMode_ Which matrix mode to query \note If an invalid matrixMode is queried, this method will return the identity matrix, and print an error message.
getVideoShader(...)
const ofShader * ofGLProgrammableRenderer::getVideoShader(const ofBaseVideoDraws &video)
rotateRad(...)
void ofGLProgrammableRenderer::rotateRad(float radians, float vecX, float vecY, float vecZ)
saveScreen(...)
void ofGLProgrammableRenderer::saveScreen(int x, int y, int w, int h, ofPixels &pixels)
setCoordHandedness(...)
void ofGLProgrammableRenderer::setCoordHandedness(ofHandednessType handedness)
setLightAmbientColor(...)
void ofGLProgrammableRenderer::setLightAmbientColor(int lightIndex, const ofFloatColor &c)
setLightAttenuation(...)
void ofGLProgrammableRenderer::setLightAttenuation(int lightIndex, float constant, float linear, float quadratic)
setLightDiffuseColor(...)
void ofGLProgrammableRenderer::setLightDiffuseColor(int lightIndex, const ofFloatColor &c)
setLightPosition(...)
void ofGLProgrammableRenderer::setLightPosition(int lightIndex, const glm::vec4 &position)
setLightSpecularColor(...)
void ofGLProgrammableRenderer::setLightSpecularColor(int lightIndex, const ofFloatColor &c)
setLightSpotConcentration(...)
void ofGLProgrammableRenderer::setLightSpotConcentration(int lightIndex, float exponent)
setLightSpotDirection(...)
void ofGLProgrammableRenderer::setLightSpotDirection(int lightIndex, const glm::vec4 &direction)
setLightSpotlightCutOff(...)
void ofGLProgrammableRenderer::setLightSpotlightCutOff(int lightIndex, float spotCutOff)
setOrientation(...)
void ofGLProgrammableRenderer::setOrientation(ofOrientation orientation, bool vFlip)
setVideoShaderUniforms(...)
void ofGLProgrammableRenderer::setVideoShaderUniforms(const ofBaseVideoDraws &video, const ofShader &shader)
setupScreenOrtho(...)
void ofGLProgrammableRenderer::setupScreenOrtho(float width, float height, float nearDist, float farDist)
setupScreenPerspective(...)
void ofGLProgrammableRenderer::setupScreenPerspective(float width, float height, float fov, float nearDist, float farDist)
viewport(...)
void ofGLProgrammableRenderer::viewport(float x, float y, float width, float height, bool vflip=true)
Last updated 화요일, 19 11월 2024 17:25:20 UTC - 2537ee49f6d46d5fe98e408849448314fd1f180e
If you have any doubt about the usage of this module you can ask in the forum.
If you want to contribute better documentation or start documenting this section you can do so here
If you find anything wrong with this docs you can report any error by opening an issue