ofDocsdocumentation gl ofGLRenderer

ofGLRenderer

The ofGLRenderer is a renderer for OF that supports OpenGL 2 and lower. It's the more classic, "direct mode" version of OpenGL that you may be familiar with but that also uses vertex arrays underneath to store all of the vertices that you create for the basic OF drawing operations. This is the default renderer that is created when you create your OF app:

ofSetupOpenGL(1024,768, OF_WINDOW);			// by default this makes a ofGLRenderer

// this kicks off the running of my app
// can be OF_WINDOW or OF_FULLSCREEN
// pass in width and height too:
ofRunApp( new testApp());

This renderer does not work so well with mobile devices (more specifically with GLES) or on ARM6/7 Linux devices (Raspberry Pi, for instance) but it is the classic version that will be supported on all laptops and desktop machines. Most of the calls to this renderer are handled by other functions, so most of this documentation will simply link to the end user functions that you should call, since you probably don't want to call the renderer directly.


background( ... )

void background(const ofColor &c)

background( ... )

void background(float brightness)

background( ... )

void background(int hexColor, float _a=255.0f)

background( ... )

void background(int r, int g, int b, int a=255)

begin( ... )

void begin(const ofFbo &fbo, ofFboMode mode)

bind( ... )

void bind(const ofCamera &camera, const ofRectangle &viewport)

bind( ... )

void bind(const ofFbo &fbo)

bind( ... )

void bind(const ofBaseMaterial &material)

bind( ... )

void bind(const ofShader &shader)

bind( ... )

void bind(const ofTexture &texture, int location)

bind( ... )

void bind(const ofBaseVideoDraws &video)

bindForBlitting( ... )

void bindForBlitting(const ofFbo &fboSrc, ofFbo &fboDst, int attachmentPoint)

clear( )

void clear()

clear( ... )

void clear(float brightness, float a)

See ofClear


clear( ... )

void clear(float r, float g, float b, float a)

See ofClear


clearAlpha( )

void clearAlpha()

See ofClear


disableAlphaMask( )

void disableAlphaMask()

disableAntiAliasing( )

void disableAntiAliasing()

disableLight( ... )

void disableLight(int lightIndex)

disableLighting( )

void disableLighting()

disablePointSprites( )

void disablePointSprites()

disableSeparateSpecularLight( )

void disableSeparateSpecularLight()

disableTextureTarget( ... )

void disableTextureTarget(int textureTarget, int textureLocation)

draw( ... )

void draw(const ofImage &image, float x, float y, float z, float w, float h, float sx, float sy, float sw, float sh)

Draws an texture.


draw( ... )

void draw(const ofFloatImage &image, float x, float y, float z, float w, float h, float sx, float sy, float sw, float sh)

Draws an texture.


draw( ... )

void draw(const ofShortImage &image, float x, float y, float z, float w, float h, float sx, float sy, float sw, float sh)

Draws an ofMesh.


draw( ... )

void draw(const ofTexture &image, float x, float y, float z, float w, float h, float sx, float sy, float sw, float sh)

draw( ... )

void draw(const ofVboMesh &mesh, ofPolyRenderMode renderType)

draw( ... )

void draw(const ofNode &model)

Draws an texture.


draw( ... )

void draw(const of3dPrimitive &model, ofPolyRenderMode renderType)

Draws a of3dPrimitive. Called internally.


draw( ... )

void draw(const ofPath &path)

Handles drawing ofPath. This is called when you call ofPath::draw().


draw( ... )

void draw(const ofPolyline &poly)

Draws an ofMesh.


draw( ... )

void draw(const ofVbo &vbo, GLuint drawMode, int first, int total)

draw( ... )

void draw(const ofMesh &vertexData, ofPolyRenderMode renderType, bool useColors, bool useTextures, bool useNormals)

Handles drawing ofPolylines. This is called when you call line.draw().


draw( ... )

void draw(const ofBaseVideoDraws &video, float x, float y, float w, float h)

drawCircle( ... )

void drawCircle(float x, float y, float z, float radius)

drawElements( ... )

void drawElements(const ofVbo &vbo, GLuint drawMode, int amt, int offsetelements=0)

drawElementsInstanced( ... )

void drawElementsInstanced(const ofVbo &vbo, GLuint drawMode, int amt, int primCount)

drawEllipse( ... )

void drawEllipse(float x, float y, float z, float width, float height)

drawInstanced( ... )

void drawInstanced(const ofVboMesh &mesh, ofPolyRenderMode renderType, int primCount)

drawInstanced( ... )

void drawInstanced(const ofVbo &vbo, GLuint drawMode, int first, int total, int primCount)

drawLine( ... )

void drawLine(float x1, float y1, float z1, float x2, float y2, float z2)

See ofLine


drawRectangle( ... )

void drawRectangle(float x, float y, float z, float w, float h)

See ofRect


drawString( ... )

void drawString(const ofTrueTypeFont &font, string text, float x, float y)

drawString( ... )

void drawString(string text, float x, float y, float z)

Draws a characters to the screen.


drawTriangle( ... )

void drawTriangle(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3)

Draw a Triangle.


enableAntiAliasing( )

void enableAntiAliasing()

enableLight( ... )

void enableLight(int lightIndex)

enableLighting( )

void enableLighting()

enablePointSprites( )

void enablePointSprites()

enableSeparateSpecularLight( )

void enableSeparateSpecularLight()

enableTextureTarget( ... )

void enableTextureTarget(const ofTexture &tex, int textureLocation)

end( ... )

void end(const ofFbo &fbo)

endSmoothing( )

void endSmoothing()

finishRender( )

void finishRender()

get3dGraphics( )

const of3dGraphics & get3dGraphics()

get3dGraphics( )

of3dGraphics & get3dGraphics()

getBackgroundAuto( )

bool getBackgroundAuto()

getBackgroundColor( )

ofColor getBackgroundColor()

getCoordHandedness( )

ofHandednessType getCoordHandedness()

getCurrentMatrix( ... )

glm::mat4 getCurrentMatrix(ofMatrixMode matrixMode_)

getCurrentNormalMatrix( )

glm::mat4 getCurrentNormalMatrix()

getCurrentOrientationMatrix( )

glm::mat4 getCurrentOrientationMatrix()

getCurrentViewMatrix( )

glm::mat4 getCurrentViewMatrix()

getCurrentViewport( )

ofRectangle getCurrentViewport()

getFillMode( )

ofFillFlag getFillMode()

getGLVersionMajor( )

int getGLVersionMajor()

getGLVersionMinor( )

int getGLVersionMinor()

getLightingEnabled( )

bool getLightingEnabled()

getNativeViewport( )

ofRectangle getNativeViewport()

getPath( )

ofPath & getPath()

getRectMode( )

ofRectMode getRectMode()

getStyle( )

ofStyle getStyle()

getType( )

const string & getType()

getViewportHeight( )

int getViewportHeight()

getViewportWidth( )

int getViewportWidth()

isVFlipped( )

bool isVFlipped()

loadIdentityMatrix( )

void loadIdentityMatrix()

loadMatrix( ... )

void loadMatrix(const glm::mat4 &m)

loadMatrix( ... )

void loadMatrix(const float *m)

loadViewMatrix( ... )

void loadViewMatrix(const glm::mat4 &m)

matrixMode( ... )

void matrixMode(ofMatrixMode mode)

multMatrix( ... )

void multMatrix(const glm::mat4 &m)

multMatrix( ... )

void multMatrix(const float *m)

multViewMatrix( ... )

void multViewMatrix(const glm::mat4 &m)

ofGLRenderer( ... )

ofGLRenderer(const ofAppBaseWindow *window)

popMatrix( )

void popMatrix()

popStyle( )

void popStyle()

popView( )

void popView()

pushMatrix( )

void pushMatrix()

pushStyle( )

void pushStyle()

pushView( )

void pushView()

rotateDeg( ... )

void rotateDeg(float radians)

rotateDeg( ... )

void rotateDeg(float radians, float vecX, float vecY, float vecZ)

rotateRad( ... )

void rotateRad(float radians)

rotateRad( ... )

void rotateRad(float radians, float vecX, float vecY, float vecZ)

rotateXDeg( ... )

void rotateXDeg(float radians)

rotateXRad( ... )

void rotateXRad(float radians)

rotateYDeg( ... )

void rotateYDeg(float radians)

rotateYRad( ... )

void rotateYRad(float radians)

rotateZDeg( ... )

void rotateZDeg(float radians)

rotateZRad( ... )

void rotateZRad(float radians)

saveFullViewport( ... )

void saveFullViewport(ofPixels &pixels)

saveScreen( ... )

void saveScreen(int x, int y, int w, int h, ofPixels &pixels)

scale( ... )

void scale(float xAmnt, float yAmnt, float zAmnt)

See ofScale


setAlphaMaskTex( ... )

void setAlphaMaskTex(const ofTexture &tex)

setBackgroundAuto( ... )

void setBackgroundAuto(bool bManual)

setBackgroundColor( ... )

void setBackgroundColor(const ofColor &c)

setBitmapTextMode( ... )

void setBitmapTextMode(ofDrawBitmapMode mode)

setBlendMode( ... )

void setBlendMode(ofBlendMode blendMode)

setCircleResolution( ... )

void setCircleResolution(int res)

setColor( ... )

void setColor(const ofColor &color)

setColor( ... )

void setColor(const ofColor &color, int _a)

setColor( ... )

void setColor(int gray)

setColor( ... )

void setColor(int r, int g, int b)

setColor( ... )

void setColor(int r, int g, int b, int a)

setCoordHandedness( ... )

void setCoordHandedness(ofHandednessType handedness)

setCurveResolution( ... )

void setCurveResolution(int resolution)

setDepthTest( ... )

void setDepthTest(bool depthTest)

setFillMode( ... )

void setFillMode(ofFillFlag fill)

setGlobalAmbientColor( ... )

void setGlobalAmbientColor(const ofColor &c)

setHexColor( ... )

void setHexColor(int hexColor)

setLightAmbientColor( ... )

void setLightAmbientColor(int lightIndex, const ofFloatColor &c)

setLightAttenuation( ... )

void setLightAttenuation(int lightIndex, float constant, float linear, float quadratic)

setLightDiffuseColor( ... )

void setLightDiffuseColor(int lightIndex, const ofFloatColor &c)

setLightPosition( ... )

void setLightPosition(int lightIndex, const glm::vec4 &position)

setLightSpecularColor( ... )

void setLightSpecularColor(int lightIndex, const ofFloatColor &c)

setLightSpotConcentration( ... )

void setLightSpotConcentration(int lightIndex, float exponent)

setLightSpotDirection( ... )

void setLightSpotDirection(int lightIndex, const glm::vec4 &direction)

setLightSpotlightCutOff( ... )

void setLightSpotlightCutOff(int lightIndex, float spotCutOff)

setLineSmoothing( ... )

void setLineSmoothing(bool smooth)

setLineWidth( ... )

void setLineWidth(float lineWidth)

setOrientation( ... )

void setOrientation(ofOrientation orientation, bool vFlip)

setPolyMode( ... )

void setPolyMode(ofPolyWindingMode mode)

setRectMode( ... )

void setRectMode(ofRectMode mode)

setSmoothLighting( ... )

void setSmoothLighting(bool b)

setStyle( ... )

void setStyle(const ofStyle &style)

setup( )

void setup()

setupGraphicDefaults( )

void setupGraphicDefaults()

setupScreen( )

void setupScreen()

setupScreenOrtho( ... )

void setupScreenOrtho(float width, float height, float nearDist, float farDist)

setupScreenPerspective( ... )

void setupScreenPerspective(float width, float height, float fov, float nearDist, float farDist)

startRender( )

void startRender()

startSmoothing( )

void startSmoothing()

texturesNeedVFlip( )

bool texturesNeedVFlip()

translate( ... )

void translate(const glm::vec3 &p)

translate( ... )

void translate(float x, float y, float z)

unbind( ... )

void unbind(const ofCamera &camera)

unbind( ... )

void unbind(const ofFbo &fbo)

unbind( ... )

void unbind(const ofBaseMaterial &material)

unbind( ... )

void unbind(const ofShader &shader)

unbind( ... )

void unbind(const ofTexture &texture, int location)

unbind( ... )

void unbind(const ofBaseVideoDraws &video)

viewport( ... )

void viewport(ofRectangle viewport)

viewport( ... )

void viewport(float x, float y, float width, float height, bool vflip=true)

~ofGLRenderer( )

~ofGLRenderer()

Variables

conststring TYPE
int alphaMaskTextureTarget
bool bBackgroundAuto
ofBitmapFont bitmapFont
ofPoint circlePoints
ofPolyline circlePolyline
GLuint currentFramebufferId< the framebuffer id currently bound to the GL_FRAMEBUFFER target
ofStyle currentStyle
GLuint defaultFramebufferId< default GL_FRAMEBUFFER_BINDING, windowing frameworks might want to set this to their MSAA framebuffer, defaults to 0
of3dGraphics graphics3d
bool lightingEnabled
ofPoint linePoints
bool materialBound
ofMatrixStack matrixStack
bool normalsEnabled
ofPath path
ofPoint rectPoints
ofPoint triPoints
constofAppBaseWindow* window

Methods