Commit 026bab16 by Kai Westerkamp

laptop support

parent 859a3df7
...@@ -31,7 +31,7 @@ void CubeWidget::initializeGL () ...@@ -31,7 +31,7 @@ void CubeWidget::initializeGL ()
glEnable(GL_LIGHT0); glEnable(GL_LIGHT0);
static GLfloat lightPosition[4] = { 0.5, 0.0, 2.0, 1.0 }; static GLfloat lightPosition[4] = { 0.5, 0.0, 2.0, 1.0 };
glLightfv(GL_LIGHT0, GL_POSITION, lightPosition); glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);
GLfloat white[] = {1.0,1.0,1.0}; //GLfloat white[] = {1.0,1.0,1.0};
//glLightfv(GL_LIGHT0, GL_DIFFUSE, white); //glLightfv(GL_LIGHT0, GL_DIFFUSE, white);
//glLightfv(GL_LIGHT0, GL_SPECULAR, white); //glLightfv(GL_LIGHT0, GL_SPECULAR, white);
//glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 2.0f); //glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 2.0f);
...@@ -283,7 +283,7 @@ void CubeWidget::move(QVector3D *newPos ) ...@@ -283,7 +283,7 @@ void CubeWidget::move(QVector3D *newPos )
QVector3D axis = QVector3D::crossProduct(*lastPos,*newPos); QVector3D axis = QVector3D::crossProduct(*lastPos,*newPos);
//warum so besser //warum so besser
float angle = 180 / M_PI * std::asin(std::sqrt(QVector3D::dotProduct(axis, axis))); float angle = 180 / M_PI * asin(sqrt(QVector3D::dotProduct(axis, axis)));
axis.normalize(); axis.normalize();
//axis = rotation->conjugate().rotatedVector(axis); //axis = rotation->conjugate().rotatedVector(axis);
......
...@@ -44,7 +44,6 @@ private: ...@@ -44,7 +44,6 @@ private:
int zoom; int zoom;
QQuaternion *rotation; QQuaternion *rotation;
QVector3D *lastPos; QVector3D *lastPos;
bool mousDown = false;
QGLShaderProgram *shader; QGLShaderProgram *shader;
......
uniform gl_LightSourceParameters gl_LightSource[gl_MaxLights];
uniform gl_MaterialParameters gl_FrontMaterial;
uniform gl_LightModelProducts gl_FrontLightModelProduct;
varying vec3 position; varying vec3 position;
varying vec3 normal; varying vec3 normal;
void main(void) void main(void)
{ {
vec3 N = normalize(normal); vec3 N = normalize(normal);
vec3 L = normalize(gl_LightSource[0].position-position); vec3 L = normalize(gl_LightSource[0].position.xyz-position);
vec4 diffuse = vec4(max(dot(L,N),0.0)); vec4 diffuse = vec4(max(dot(L,N),0.0));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment