diff options
Diffstat (limited to 'src/mapUtils.cpp')
| -rw-r--r-- | src/mapUtils.cpp | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/mapUtils.cpp b/src/mapUtils.cpp index 3787bf4..3dd3d7c 100644 --- a/src/mapUtils.cpp +++ b/src/mapUtils.cpp @@ -33,6 +33,29 @@ void unbindTexture(ofBaseHasTexture &t) { glPopMatrix(); glMatrixMode(GL_MODELVIEW); } +void bindTex(ofTexture &tex) { + tex.bind(); + + glMatrixMode(GL_TEXTURE); + glPushMatrix(); + glLoadIdentity(); + + ofTextureData texData = tex.getTextureData(); + if(texData.textureTarget == GL_TEXTURE_RECTANGLE_ARB) { + glScalef(tex.getWidth(), tex.getHeight(), 1.0f); + } else { + glScalef(tex.getWidth() / texData.tex_w, tex.getHeight() / texData.tex_h, 1.0f); + } + + glMatrixMode(GL_MODELVIEW); +} +void unbindTex(ofTexture &tex) { + tex.unbind(); + + glMatrixMode(GL_TEXTURE); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); +} ofPoint distort(ofPoint pt,float d){ //normalised coords -1..1, d float r=pow(pow(pow(pt.x,2.0f)+pow(pt.y,2.0f),0.5f),1.0f+d); @@ -89,17 +112,17 @@ void drawBoard(float x,float y,float z) { glVertex3f(cx+8, 0, cz+8); glVertex3f(cx+4, 0, cz+4); glVertex3f(cx+4, 0, cz-4); - + glVertex3f(cx+4, 0, cz+4); glVertex3f(cx+8, 0, cz+8); glVertex3f(cx-8, 0, cz+8); glVertex3f(cx-4, 0, cz+4); - + glVertex3f(cx-4, 0, cz-4); glVertex3f(cx-4, 0, cz+4); glVertex3f(cx-8, 0, cz+8); glVertex3f(cx-8, 0, cz-8); - + glVertex3f(cx+8, 0, cz-8); glVertex3f(cx+4, 0, cz-4); glVertex3f(cx-4, 0, cz-4); |
