   Problems with per pixel lighting and VFC [no ff]
  Hello,I've been trying for a couple of days now to fix whatever is wrong with my per pixel lighting and view frustum culling but neither seem to work as intended.Per pixel lighting:Please have a look at the lighting in my scene: http://i45.tinypic.com/2edo5lg.pngWhat you see, is a light source that started out at the top right and was moved downwards.Instead of the initial spotlight following the movement this path of light is created where everything that was "walked" on will get illuminated.In my application, the light source is intended to be a point light that is being moved around. So my question is: How does one move a light source correctly?My implementation: Light per pixel calculated through Phong shading, using self defined light position vector (no fixed function glLight available to me). To move the light I update the light's position vector by adding the current position found in 3rd column of the model matrix.View Frustum Culling:As you can also see on the screenshot, there are 13 of 13 objects rendered even though half the scene is not visible. I followed the lighthouse3d on clip space VFC closely, however I can't achieve any culling whatsoever.My pseudo code:1) Bounding box creation per meshfor each vertex in vertices   if(vertex.x < lowest.x) lowest.x = vertex.x   ...   ...   if(vertex.z > highest.z) highest.z = vertex.zendbbox[0] = lowest;bbox[1] = vec3(lowest.x,  highest.y, lowest.z);bbox[2] = vec3(highest.x, highest.y, lowest.z);bbox[3] = vec3(highest.x, lowest.y,  lowest.z);bbox[4] = vec3(highest.x, lowest.y,  highest.z);bbox[5] = vec3(lowest.x,  lowest.y,  highest.z);bbox[6] = vec3(lowest.x,  highest.y, highest.z);bbox[7] = highest;2) Clip extraction based on clip space approachvoid Frustum::createPlane(int type, float a, float b, float c, float d){   Plane current;// set the normal vectorcurrent.normal = vec3(a, b, c);//compute the lenght of the vectorfloat l = length(current.normal);// normalize the vectorcurrent.normal = vec3(a/l, b/l, c/l);// and divide d by th length as wellcurrent.distance = d/l;//Add to planesthis->planes[type] = current;}3) Testing bounding boxesbool Frustum::isBoxInsideFrustum(vec3 *bbox){   for each plane in planes counter = 0;  for each vertex in bbox    distance = dot(plane.normal, vertex) + plane.distance;    //Vertex outside    if(distance < -epsilon) counter++; end; //All vertices are outside if(counter==8) return false;   end;   //Box is inside   return true;}4) Setting matrix for plane extraction in game loopThe camera in my application is set to follow the character. It's placed slighty behind the character and always updates to the way the character changes. Each time update() is called during my game loop, I send following matrix to the Frustum class to create the new view frustum:camera->getView() * camera->getPerspective()where camera->getView() returns: character->getView() * inverse(character->getModel());(Update camera to follow the character)and camera->getPerspective() returns: perspective(60.0f, aspect, 0.1f, 1000.0f);  our projection.5) Testing before renderingIn render() I iterate over all entities and call their render() method if(frustum.isBoxInsideFrustum(entities->getMesh()->getBbox()) is trueTesting around:I printed out the vertices counter specified earlier and it always seems to be stuck on 4 no matter how I tilt the camera around.I'm sorry for this lengthy post, I'm quite desperate as our deadline is approaching and I can't figure this out on my own. Every bit of help is greatly appreciated!Edit: Also sorry for possibly using the wrong subforum :(   