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(){
_moved = false;
ofEnableNormalizedTexCoords();
createDefaultTexture();
}

7
src/Surfaces/GridWarpSurface.cpp

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

14
src/Surfaces/QuadSurface.cpp

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

7
src/Surfaces/TriangleSurface.cpp

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

Loading…
Cancel
Save