reference

This documentation is automatically generated from the openFrameworks source code using doxygen and refers to the most recent release, version 0.12.0.

ofTexture.cpp File Reference
#include "ofTexture.h"
#include "ofGraphics.h"
#include "ofPixels.h"
#include "ofGLUtils.h"
#include "ofGLBaseTypes.h"
#include "ofBufferObject.h"
#include "ofMesh.h"
#include <unordered_map>

Functions

void ofEnableTextureEdgeHack ()
 Enable the global texture "edge hack" to compensate for edge artifacts.
 
void ofDisableTextureEdgeHack ()
 Disable global texture "edge hack".
 
bool ofIsTextureEdgeHackEnabled ()
 Check whether OF is using the texture "edge hack".
 
bool ofGetUsingNormalizedTexCoords ()
 Check whether OF is using normalized or pixel texture coordinates.
 
void ofEnableNormalizedTexCoords ()
 Use normalized (0 - 1) texture coordinates.
 
void ofDisableNormalizedTexCoords ()
 Use pixel-based texture coordinates.
 
void ofSetTextureWrap (GLfloat wrapS, GLfloat wrapT)
 
bool ofGetUsingCustomTextureWrap ()
 
void ofRestoreTextureWrap ()
 
void ofSetMinMagFilters (GLfloat minFilter, GLfloat magFilter)
 
bool ofGetUsingCustomMinMagFilters ()
 
void ofRestoreMinMagFilters ()
 
bool ofGetUsingArbTex ()
 Check whether OF is using GL_TEXTURE_RECTANGLE rectangular or GL_TEXTURE_2D textures.
 
void ofEnableArbTex ()
 Use GL_TEXTURE_RECTANGLE textures.
 
void ofDisableArbTex ()
 Use GL_TEXTURE_2D textures.
 

Function Documentation

◆ ofDisableArbTex()

void ofDisableArbTex ( )

Use GL_TEXTURE_2D textures.

GL_TEXTURE_2D is OpenGL's default way of handling textures and supports a wider range of core OpenGL features such as mipmaps.

See also
ofEnableArbTex()

◆ ofDisableNormalizedTexCoords()

void ofDisableNormalizedTexCoords ( )

Use pixel-based texture coordinates.

See also
ofEnableNormalizedTexCoords()

◆ ofDisableTextureEdgeHack()

void ofDisableTextureEdgeHack ( )

Disable global texture "edge hack".

Todo:
Add docs on why the "edge hack" is needed.
See also
ofEnableTextureEdgeHack()

◆ ofEnableArbTex()

void ofEnableArbTex ( )

Use GL_TEXTURE_RECTANGLE textures.

GL_TEXTURE_RECTANGLE textures are more intuitive since they allow pixel based coordinates and are enabled by default.

GL_TEXTURE_2D textures use normalised texture coordinates (a float value between 0 and 1 is used to express texture coordinates along width and height).

GL_TEXTURE_2D textures are more widely supported and allow advanced features such as mipmaps and texture compression.

See also
ofDisableArbTex()
Warning
GL_TEXTURE_RECTANGLE is not available in OpenGL ES.
GL_TEXTURE_RECTANGLE does not support mipmaps.

◆ ofEnableNormalizedTexCoords()

void ofEnableNormalizedTexCoords ( )

Use normalized (0 - 1) texture coordinates.

By default, textures in OF work with pixel-based coordinates based on given content dimensions (images size, fbo size, etc). Normalized (0 - 1) coordinates are the traditional OpenGL default as they allow working with internal texture data without having to worry about specific dimensions of the content.

This overrides individual ofTexture wrap settings.

See also
http://www.opengl.org/sdk/docs/man4/html/glTexParameter.xhtml

◆ ofEnableTextureEdgeHack()

void ofEnableTextureEdgeHack ( )

Enable the global texture "edge hack" to compensate for edge artifacts.

Adds a 2 pixel offset to avoid possible edge artifacts (typically a black or white border). This very slightly alters the image by scaling. This is enabled by default.

◆ ofGetUsingArbTex()

bool ofGetUsingArbTex ( )

Check whether OF is using GL_TEXTURE_RECTANGLE rectangular or GL_TEXTURE_2D textures.

Texture Settings

See also
ofEnableArbTex()
Returns
true if using GL_TEXTURE_RECTANGLE textures, false if using GL_TEXTURE_2D textures.

◆ ofGetUsingCustomMinMagFilters()

bool ofGetUsingCustomMinMagFilters ( )

◆ ofGetUsingCustomTextureWrap()

bool ofGetUsingCustomTextureWrap ( )

◆ ofGetUsingNormalizedTexCoords()

bool ofGetUsingNormalizedTexCoords ( )

Check whether OF is using normalized or pixel texture coordinates.

See also
ofEnableNormalizedTexCoords()
Returns
true if using normalized (0 - 1) texture coordinates.

◆ ofIsTextureEdgeHackEnabled()

bool ofIsTextureEdgeHackEnabled ( )

Check whether OF is using the texture "edge hack".

See also
ofEnableTextureEdgeHack()
Returns
true if OF is currently using the texture "edge hack".

◆ ofRestoreMinMagFilters()

void ofRestoreMinMagFilters ( )

◆ ofRestoreTextureWrap()

void ofRestoreTextureWrap ( )

◆ ofSetMinMagFilters()

void ofSetMinMagFilters ( GLfloat  minFilter,
GLfloat  magFilter 
)

◆ ofSetTextureWrap()

void ofSetTextureWrap ( GLfloat  wrapS,
GLfloat  wrapT 
)