summaryrefslogtreecommitdiff
path: root/src/mapUtils.cpp
diff options
context:
space:
mode:
authorTim Redfern <tim@eclectronics.org>2012-03-21 20:48:21 +0000
committerTim Redfern <tim@eclectronics.org>2012-03-21 20:48:21 +0000
commit3d5588a7ead64f3b11ef132f21469b9471819850 (patch)
tree292c98a38e4979b662d217d5325e11112a57a161 /src/mapUtils.cpp
parentbba06c387bb44c46bf035bf6b68558dd34833879 (diff)
misc
Diffstat (limited to 'src/mapUtils.cpp')
-rw-r--r--src/mapUtils.cpp29
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);