Browse Source

Leave no trace after using `ofEnableNormalizedTexCoords()`

master
Krisjanis Rijnieks 9 years ago
parent
commit
c681e2e8b0
  1. 1
      src/Surfaces/BaseSurface.cpp
  2. 7
      src/Surfaces/GridWarpSurface.cpp
  3. 14
      src/Surfaces/QuadSurface.cpp
  4. 7
      src/Surfaces/TriangleSurface.cpp

1
src/Surfaces/BaseSurface.cpp

@ -5,7 +5,6 @@ namespace piMapper {
BaseSurface::BaseSurface(){ BaseSurface::BaseSurface(){
_moved = false; _moved = false;
ofEnableNormalizedTexCoords();
createDefaultTexture(); createDefaultTexture();
} }

7
src/Surfaces/GridWarpSurface.cpp

@ -18,9 +18,16 @@ void GridWarpSurface::draw(){
return; return;
} }
bool normalizedTexCoords = ofGetUsingNormalizedTexCoords();
ofEnableNormalizedTexCoords();
source->getTexture()->bind(); source->getTexture()->bind();
mesh.draw(); mesh.draw();
source->getTexture()->unbind(); source->getTexture()->unbind();
if(!normalizedTexCoords){
ofDisableNormalizedTexCoords();
}
} }
void GridWarpSurface::moveBy(ofVec2f v){ void GridWarpSurface::moveBy(ofVec2f v){

14
src/Surfaces/QuadSurface.cpp

@ -78,16 +78,30 @@ void QuadSurface::draw(){
ofPushMatrix(); ofPushMatrix();
if(true){ if(true){
bool normalizedTexCoords = ofGetUsingNormalizedTexCoords();
ofEnableNormalizedTexCoords();
glMultMatrixf(_matrix); glMultMatrixf(_matrix);
source->getTexture()->bind(); source->getTexture()->bind();
m.draw(); m.draw();
source->getTexture()->unbind(); source->getTexture()->unbind();
if(!normalizedTexCoords){
ofDisableNormalizedTexCoords();
}
} }
ofPopMatrix(); ofPopMatrix();
}else{ }else{
bool normalizedTexCoords = ofGetUsingNormalizedTexCoords();
ofEnableNormalizedTexCoords();
source->getTexture()->bind(); source->getTexture()->bind();
mesh.draw(); mesh.draw();
source->getTexture()->unbind(); source->getTexture()->unbind();
if(!normalizedTexCoords){
ofDisableNormalizedTexCoords();
}
} }
} }

7
src/Surfaces/TriangleSurface.cpp

@ -51,9 +51,16 @@ void TriangleSurface::draw(){
return; return;
} }
bool normalizedTexCoords = ofGetUsingNormalizedTexCoords();
ofEnableNormalizedTexCoords();
source->getTexture()->bind(); source->getTexture()->bind();
mesh.draw(); mesh.draw();
source->getTexture()->unbind(); source->getTexture()->unbind();
if(!normalizedTexCoords){
ofDisableNormalizedTexCoords();
}
} }
void TriangleSurface::setVertex(int index, ofVec2f p){ void TriangleSurface::setVertex(int index, ofVec2f p){

Loading…
Cancel
Save