# lighthouse3d tutorial + ofxShader help

Hi,

I am learning GLSL, so I am following alone the Lighthouse3D tutorials and I am using the ofxShader addon, lesson 1 and 2 were OK but I am stuck in lesson 3 http://www.lighthouse3d.com/opengl/glsl/index.php?flatten

The problem is that the vertex shader use a time variable to deform in time the teapot, and this time variable is not been updated, here is my code:
testApp.cpp

``````

void testApp::draw(){

glViewport(0, 0, ofGetWidth(), ofGetHeight());
glMatrixMode(GL_PROJECTION);
gluPerspective(45.0f, (GLfloat)ofGetWidth() / (GLfloat)ofGetHeight(), 0.1f, 100.0f);
glMatrixMode(GL_MODELVIEW);

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
gluLookAt(0.0, 0.0, 5.0,
0.0, 0.0, 0.0,
0.0f, 1.0f, 0.0f);

time += 0.01;

ofSetColor(100, 100, 200);
glutSolidTeapot(1.0f);

//glutSwapBuffers();
}

``````

and the shader code is simple.vert

``````

uniform float time;

void main(void) {
vec4 v = vec4(gl_Vertex);
v.z = sin(5.0 * v.x + time * 0.01) * 0.25;

gl_Position = gl_ModelViewProjectionMatrix * v;
}

``````

Another thing thats giving me a headache is that the coordinates seems to be different from the tutorial, for example when they flatten on Z my results are in Y, any ideas?

rS

Ok I found a solution to 1 of the issues, it does work the problem was in the line

``````
v.z = sin(5.0 * v.x + time * 0.01) * 0.25;

``````

of the vertex shader, take out the 0.01 and the teapot does wave.

Now I am still trying to figure out why my Y, Z coordinates are different from the tutorial

Any ideas?

Cheers
rS