istereo
changeset 24:70309d71c899
added the texture translation
author | John Tsiombikas <nuclear@mutantstargoat.com> |
---|---|
date | Thu, 08 Sep 2011 03:06:46 +0300 |
parents | e3742aafc85b |
children | 206348366635 |
files | sdr/test.v.glsl src/glutmain.c src/istereo.c |
diffstat | 3 files changed, 25 insertions(+), 7 deletions(-) [+] |
line diff
1.1 --- a/sdr/test.v.glsl Thu Sep 08 02:57:29 2011 +0300 1.2 +++ b/sdr/test.v.glsl Thu Sep 08 03:06:46 2011 +0300 1.3 @@ -1,4 +1,4 @@ 1.4 -uniform mat4 matrix_modelview, matrix_projection; 1.5 +uniform mat4 matrix_modelview, matrix_projection, matrix_texture; 1.6 1.7 attribute vec4 attr_vertex, attr_color; 1.8 attribute vec2 attr_texcoord; 1.9 @@ -13,5 +13,5 @@ 1.10 gl_Position = mvp * attr_vertex; 1.11 vpos = (matrix_modelview * attr_vertex).xyz; 1.12 var_color = attr_color; 1.13 - var_texcoord = attr_texcoord; 1.14 + var_texcoord = (matrix_texture * vec4(attr_texcoord, 0.0, 1.0)).xy; 1.15 }
2.1 --- a/src/glutmain.c Thu Sep 08 02:57:29 2011 +0300 2.2 +++ b/src/glutmain.c Thu Sep 08 03:06:46 2011 +0300 2.3 @@ -12,7 +12,7 @@ 2.4 int main(int argc, char **argv) 2.5 { 2.6 glutInit(&argc, argv); 2.7 - glutInitWindowSize(640, 960); 2.8 + glutInitWindowSize(960, 640); 2.9 glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); 2.10 glutCreateWindow("test"); 2.11 2.12 @@ -38,12 +38,27 @@ 2.13 glutSwapBuffers(); 2.14 } 2.15 2.16 +extern int stereo; 2.17 + 2.18 void keyb(unsigned char key, int x, int y) 2.19 { 2.20 switch(key) { 2.21 case 27: 2.22 exit(0); 2.23 2.24 + case 's': 2.25 + stereo = !stereo; 2.26 + break; 2.27 + 2.28 + case '`': 2.29 + { 2.30 + int xsz = glutGet(GLUT_WINDOW_WIDTH); 2.31 + int ysz = glutGet(GLUT_WINDOW_HEIGHT); 2.32 + 2.33 + glutReshapeWindow(ysz, xsz); 2.34 + } 2.35 + break; 2.36 + 2.37 default: 2.38 break; 2.39 }
3.1 --- a/src/istereo.c Thu Sep 08 02:57:29 2011 +0300 3.2 +++ b/src/istereo.c Thu Sep 08 03:06:46 2011 +0300 3.3 @@ -23,7 +23,11 @@ 3.4 3.5 int view_xsz, view_ysz; 3.6 3.7 +#ifdef IPHONE 3.8 int stereo = 1; 3.9 +#else 3.10 +int stereo = 0; 3.11 +#endif 3.12 3.13 /* construction parameters */ 3.14 int sides = 24; 3.15 @@ -164,10 +168,9 @@ 3.16 3.17 bind_texture(tex, 0); 3.18 3.19 - /*glMatrixMode(GL_TEXTURE); 3.20 - glLoadIdentity(); 3.21 - //glTranslatef(0, -t * 1.5, 0); 3.22 - glTranslatef(0, -t * 0.5, 0);*/ 3.23 + gl_matrix_mode(GL_TEXTURE); 3.24 + gl_load_identity(); 3.25 + gl_translatef(0, -t * 0.75, 0); 3.26 3.27 gl_begin(GL_QUADS); 3.28 gl_color3f(1.0, 1.0, 1.0);