Permalink
Browse files

ofGraphics: moved texture functions to ofTexture

  • Loading branch information...
1 parent 084e8de commit 9051c1569fa3de04b128b784464b795791ba2b5e @arturoc arturoc committed Dec 22, 2011
@@ -5,7 +5,12 @@
#include "ofPixels.h"
#include <map>
+//----------------------------------------------------------
+// static
static bool bTexHackEnabled = true;
+static bool bUsingArbTex = true;
+static bool bUsingNormalizedTexCoords = false;
+static bool bUseCustomMinMagFilters = false;
//---------------------------------
template <class T>
@@ -233,6 +238,89 @@ void ofDisableTextureEdgeHack(){
bTexHackEnabled = false;
}
+bool ofGetUsingNormalizedTexCoords(){
+ return bUsingNormalizedTexCoords;
+}
+
+void ofEnableNormalizedTexCoords(){
+ bUsingNormalizedTexCoords = true;
+}
+
+void ofDisableNormalizedTexCoords(){
+ bUsingNormalizedTexCoords = false;
+}
+
+
+
+//***** add global functions to override texture settings
+//----------------------------------------------------------
+static bool bUseCustomTextureWrap = false;
+
+//----------------------------------------------------------
+void ofSetTextureWrap(GLfloat wrapS, GLfloat wrapT){
+ bUseCustomTextureWrap = true;
+ GLenum textureTarget = GL_TEXTURE_2D;
+#ifndef TARGET_OPENGLES
+ if (ofGetUsingArbTex() && GL_ARB_texture_rectangle){
+ textureTarget = GL_TEXTURE_RECTANGLE_ARB;
+ };
+#endif
+ glTexParameterf(textureTarget, GL_TEXTURE_WRAP_S, wrapS);
+ glTexParameterf(textureTarget, GL_TEXTURE_WRAP_T, wrapT);
+}
+
+//----------------------------------------------------------
+bool ofGetUsingCustomTextureWrap(){
+ return bUseCustomTextureWrap;
+}
+
+//----------------------------------------------------------
+void ofRestoreTextureWrap(){
+ bUseCustomTextureWrap = false;
+}
+
+//----------------------------------------------------------
+void ofSetMinMagFilters(GLfloat minFilter, GLfloat maxFilter){
+ bUseCustomMinMagFilters = true;
+ GLenum textureTarget = GL_TEXTURE_2D;
+#ifndef TARGET_OPENGLES
+ if (ofGetUsingArbTex() && GL_ARB_texture_rectangle){
+ textureTarget = GL_TEXTURE_RECTANGLE_ARB;
+ };
+#endif
+ glTexParameterf(textureTarget, GL_TEXTURE_MIN_FILTER, minFilter);
+ glTexParameterf(textureTarget, GL_TEXTURE_MAG_FILTER, maxFilter);
+}
+
+//----------------------------------------------------------
+bool ofGetUsingCustomMinMagFilters(){
+ return bUseCustomMinMagFilters;
+}
+
+//----------------------------------------------------------
+void ofRestoreMinMagFilters(){
+ bUseCustomMinMagFilters = false;
+}
+
+//***** global functions to override texture settings
+
+
+//----------------------------------------------------------
+bool ofGetUsingArbTex(){
+ return bUsingArbTex;
+}
+
+//----------------------------------------------------------
+void ofEnableArbTex(){
+ bUsingArbTex = true;
+}
+
+//----------------------------------------------------------
+void ofDisableArbTex(){
+ bUsingArbTex = false;
+}
+
+
static map<GLuint,int> & getTexturesIndex(){
static map<GLuint,int> * textureReferences = new map<GLuint,int>;
return *textureReferences;
@@ -11,6 +11,27 @@ int ofGetGlInternalFormat(const ofFloatPixels& pix);
void ofGetGlFormatAndType(int glInternalFormat, int& glFormat, int& glType);
ofImageType ofGetImageTypeFromGLType(int glType);
+//set whether OF uses ARB rectangular texture or the more traditonal GL_TEXTURE_2D
+bool ofGetUsingArbTex();
+void ofEnableArbTex();
+void ofDisableArbTex();
+
+
+bool ofGetUsingNormalizedTexCoords();
+void ofEnableNormalizedTexCoords();
+void ofDisableNormalizedTexCoords();
+
+
+//***** add global functions to override texture settings
+void ofSetTextureWrap(GLfloat wrapS = GL_CLAMP_TO_EDGE, GLfloat wrapT = GL_CLAMP_TO_EDGE);
+bool ofGetUsingCustomTextureWrap();
+void ofRestoreTextureWrap();
+
+void ofSetMinMagFilters(GLfloat minFilter = GL_LINEAR, GLfloat maxFilter = GL_LINEAR);
+bool ofGetUsingCustomMinMagFilters();
+void ofRestoreMinMagFilters();
+//*****
+
//Sosolimited: texture compression
enum ofTexCompression
{
@@ -38,10 +38,6 @@
#endif
-//----------------------------------------------------------
-// static
-static bool bUsingArbTex = true;
-static bool bUsingNormalizedTexCoords = false;
//style stuff - new in 006
static ofStyle currentStyle;
@@ -131,101 +127,6 @@ void ofEndSaveScreenAsPDF(){
#endif
-// opengl specifics
-
-bool ofGetUsingNormalizedTexCoords(){
- return bUsingNormalizedTexCoords;
-}
-
-void ofEnableNormalizedTexCoords(){
- bUsingNormalizedTexCoords = true;
-}
-
-void ofDisableNormalizedTexCoords(){
- bUsingNormalizedTexCoords = false;
-}
-
-
-
-//***** add global functions to override texture settings
-//----------------------------------------------------------
-static bool bUseCustomTextureWrap = false;
-
-//----------------------------------------------------------
-void ofSetTextureWrap(GLfloat wrapS, GLfloat wrapT){
- bUseCustomTextureWrap = true;
- GLenum textureTarget = GL_TEXTURE_2D;
-#ifndef TARGET_OPENGLES
- if (ofGetUsingArbTex() && GL_ARB_texture_rectangle){
- textureTarget = GL_TEXTURE_RECTANGLE_ARB;
- };
-#endif
- glTexParameterf(textureTarget, GL_TEXTURE_WRAP_S, wrapS);
- glTexParameterf(textureTarget, GL_TEXTURE_WRAP_T, wrapT);
-}
-
-//----------------------------------------------------------
-bool ofGetUsingCustomTextureWrap(){
- return bUseCustomTextureWrap;
-}
-
-//----------------------------------------------------------
-void ofRestoreTextureWrap(){
- bUseCustomTextureWrap = false;
-}
-
-
-
-static bool bUseCustomMinMagFilters = false;
-//----------------------------------------------------------
-void ofSetMinMagFilters(GLfloat minFilter, GLfloat maxFilter){
- bUseCustomMinMagFilters = true;
- GLenum textureTarget = GL_TEXTURE_2D;
-#ifndef TARGET_OPENGLES
- if (ofGetUsingArbTex() && GL_ARB_texture_rectangle){
- textureTarget = GL_TEXTURE_RECTANGLE_ARB;
- };
-#endif
- glTexParameterf(textureTarget, GL_TEXTURE_MIN_FILTER, minFilter);
- glTexParameterf(textureTarget, GL_TEXTURE_MAG_FILTER, maxFilter);
-}
-
-//----------------------------------------------------------
-bool ofGetUsingCustomMinMagFilters(){
- return bUseCustomMinMagFilters;
-}
-
-//----------------------------------------------------------
-void ofRestoreMinMagFilters(){
- bUseCustomMinMagFilters = false;
-}
-
-//***** global functions to override texture settings
-
-
-//----------------------------------------------------------
-bool ofGetUsingArbTex(){
- return bUsingArbTex;
-}
-
-//----------------------------------------------------------
-void ofEnableArbTex(){
- bUsingArbTex = true;
-}
-
-//----------------------------------------------------------
-void ofDisableArbTex(){
- bUsingArbTex = false;
-}
-
-//end opengl specifics
-
-
-
-
-
-
-
//----------------------------------------------------------
@@ -20,33 +20,6 @@ ofPtr<ofGLRenderer> ofGetGLRenderer();
void ofBeginSaveScreenAsPDF(string filename, bool bMultipage = false, bool b3D = false, ofRectangle viewport = ofRectangle(0,0,0,0));
void ofEndSaveScreenAsPDF();
-//opengl specifics
-
-//set whether OF uses ARB rectangular texture or the more traditonal GL_TEXTURE_2D
-bool ofGetUsingArbTex();
-void ofEnableArbTex();
-void ofDisableArbTex();
-
-
-bool ofGetUsingNormalizedTexCoords();
-void ofEnableNormalizedTexCoords();
-void ofDisableNormalizedTexCoords();
-
-
-//***** add global functions to override texture settings
-void ofSetTextureWrap(GLfloat wrapS = GL_CLAMP_TO_EDGE, GLfloat wrapT = GL_CLAMP_TO_EDGE);
-bool ofGetUsingCustomTextureWrap();
-void ofRestoreTextureWrap();
-
-void ofSetMinMagFilters(GLfloat minFilter = GL_LINEAR, GLfloat maxFilter = GL_LINEAR);
-bool ofGetUsingCustomMinMagFilters();
-void ofRestoreMinMagFilters();
-//*****
-
-//end opengl specifics
-
-
-
// transformations
// push and pop all matrices and viewport

0 comments on commit 9051c15

Please sign in to comment.