Commit 1cae4594 by Kai Westerkamp

Merge branch 'master' of ssh://git.breab.org:2223/kai/GraPa

# Conflicts: # A4/hellocube.pro.user
parents dac45821 5d3de742
/A1/build-hellocube-Desktop_Qt_5_4_2_MSVC2013_OpenGL_64bit-Debug /A1/build-hellocube-Desktop_Qt_5_4_2_MSVC2013_OpenGL_64bit-Debug
/A1/hellocube/*.user
/build-hellocube-Desktop_Qt_5_4_2_MSVC2013_OpenGL_64bit-Debug /build-hellocube-Desktop_Qt_5_4_2_MSVC2013_OpenGL_64bit-Debug
/build-hellocube-Desktop_Qt_5_5_1_MinGW_32bit-Debug /build-hellocube-Desktop_Qt_5_5_1_MinGW_32bit-Debug
/build-hellocube-Desktop_Qt_5_5_1_MSVC2013_64bit-Debug /build-hellocube-Desktop_Qt_5_5_1_MSVC2013_64bit-Debug
/A2/*.user *.user
build-hellocube-Desktop_Qt_5_4_2_MinGW_32bit2-Debug build-hellocube-Desktop_Qt_5_4_2_MinGW_32bit2-Debug
build-hellocube-Desktop_Qt_5_4_2_MSVC2013_OpenGL_64bit-Debug build-hellocube-Desktop_Qt_5_4_2_MSVC2013_OpenGL_64bit-Debug
build-hellocube-Desktop_Qt_5_4_2_MSVC2013_OpenGL_64bit-Release build-hellocube-Desktop_Qt_5_4_2_MSVC2013_OpenGL_64bit-Release
/A4/hellocube.pro.user
*.zip
/A5/build-Animation-Desktop_Qt_5_5_1_MinGW_32bit-Debug
/assimp-3.1.1-win-binaries
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
GLView::GLView(Scene *scene,Camera * camera,Controler *controler ) GLView::GLView(Scene *scene,Camera * camera,Controler *controler,QGLFormat format )
:QGLWidget(format)
{ {
this->camera = camera; this->camera = camera;
this->scene = scene; this->scene = scene;
...@@ -55,6 +56,10 @@ QSize GLView::sizeHint() const ...@@ -55,6 +56,10 @@ QSize GLView::sizeHint() const
void GLView::initializeGL ( ) { void GLView::initializeGL ( ) {
qDebug() << "Current Context:" << this->format();
Q_ASSERT(initializeOpenGLFunctions()); Q_ASSERT(initializeOpenGLFunctions());
qDebug()<<"OpenGL Version"<<this->format().majorVersion()<<this->format().minorVersion(); qDebug()<<"OpenGL Version"<<this->format().majorVersion()<<this->format().minorVersion();
......
...@@ -9,10 +9,10 @@ ...@@ -9,10 +9,10 @@
#include <scene.h> #include <scene.h>
#include <gl/GLU.h> #include <gl/GLU.h>
#include <QGLFunctions> #include <QGLFunctions>
#include <QOpenGLFunctions_4_3_Core> #include <QOpenGLFunctions_4_0_Core>
#include <math.h> #include <math.h>
class GLView : public QGLWidget, public QOpenGLFunctions_4_3_Core class GLView : public QGLWidget, public QOpenGLFunctions_4_0_Core
{ {
Q_OBJECT Q_OBJECT
protected : protected :
...@@ -38,7 +38,7 @@ public slots: ...@@ -38,7 +38,7 @@ public slots:
public: public:
GLView(Scene *scene,Camera * camera,Controler *controler ); GLView(Scene *scene,Camera * camera,Controler *controler,QGLFormat format );
void setHome(QQuaternion *rotation, QVector3D *translation); void setHome(QQuaternion *rotation, QVector3D *translation);
......
...@@ -11,7 +11,9 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets ...@@ -11,7 +11,9 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = hellocube TARGET = hellocube
TEMPLATE = app TEMPLATE = app
LIBS += -lglut64 #LIBS += -lglut64
LIBS += -lglut32
#LIBS += -L./glut/
LIBS += -L$$PWD/glut LIBS += -L$$PWD/glut
SOURCES += main.cpp\ SOURCES += main.cpp\
......
...@@ -4,23 +4,27 @@ ...@@ -4,23 +4,27 @@
void MainWindow::initViews() void MainWindow::initViews()
{ {
QGLFormat glFormat;
glFormat.setVersion( 4, 4 );
glFormat.setProfile( QGLFormat::CoreProfile ); // Requires >=Qt-4.8.0
Camera *perspectiveCam = new Camera(true); Camera *perspectiveCam = new Camera(true);
perspectiveView = new GLView(scene,perspectiveCam,controler); perspectiveView = new GLView(scene,perspectiveCam,controler,glFormat);
Camera *frontCam = new Camera(false); Camera *frontCam = new Camera(false);
frontCam->setHome(new QQuaternion(), new QVector3D(0.0,0.0,-4.0)); frontCam->setHome(new QQuaternion(), new QVector3D(0.0,0.0,-4.0));
frontView = new GLView(scene,frontCam,controler); frontView = new GLView(scene,frontCam,controler,glFormat);
Camera *leftCam = new Camera(false); Camera *leftCam = new Camera(false);
leftCam->setHome(new QQuaternion(QQuaternion::fromAxisAndAngle(0.0,1.0,0.0,90.0).toVector4D()), leftCam->setHome(new QQuaternion(QQuaternion::fromAxisAndAngle(0.0,1.0,0.0,90.0).toVector4D()),
new QVector3D(0.0,0.0,-4.0)); new QVector3D(0.0,0.0,-4.0));
leftView = new GLView(scene,leftCam,controler); leftView = new GLView(scene,leftCam,controler,glFormat);
Camera *topCam = new Camera(false); Camera *topCam = new Camera(false);
topCam->setHome(new QQuaternion(QQuaternion::fromAxisAndAngle(1.0,0.0,0.0,90.0).toVector4D()), topCam->setHome(new QQuaternion(QQuaternion::fromAxisAndAngle(1.0,0.0,0.0,90.0).toVector4D()),
new QVector3D(0.0,0.0,-4.0)); new QVector3D(0.0,0.0,-4.0));
topView = new GLView(scene,topCam,controler); topView = new GLView(scene,topCam,controler,glFormat);
views = new GLView*[4]; views = new GLView*[4];
views[0] = perspectiveView; views[0] = perspectiveView;
......
...@@ -70,7 +70,7 @@ void Scene::addSceneObjectTaActive(SceneObject *obj){ ...@@ -70,7 +70,7 @@ void Scene::addSceneObjectTaActive(SceneObject *obj){
void Scene::addCube() void Scene::addCube()
{ {
float color[] = {0.0,0.0,1.0}; float color[] = {0.0,0.0,1.0};
ScenePrimitive *primitive = new ScenePrimitive(PrimitiveType::Quader,tesselation); ScenePrimitive *primitive = new ScenePrimitive(Quader,tesselation);
primitive->setMaterial(color); primitive->setMaterial(color);
addSceneObjectTaActive(primitive); addSceneObjectTaActive(primitive);
} }
...@@ -78,7 +78,7 @@ void Scene::addCube() ...@@ -78,7 +78,7 @@ void Scene::addCube()
void Scene::addSphere() void Scene::addSphere()
{ {
float color[] = {0.0,1.0,0.0}; float color[] = {0.0,1.0,0.0};
ScenePrimitive *primitive = new ScenePrimitive(PrimitiveType::Sphere,tesselation); ScenePrimitive *primitive = new ScenePrimitive(Sphere,tesselation);
primitive->setMaterial(color); primitive->setMaterial(color);
addSceneObjectTaActive(primitive); addSceneObjectTaActive(primitive);
} }
...@@ -86,7 +86,7 @@ void Scene::addSphere() ...@@ -86,7 +86,7 @@ void Scene::addSphere()
void Scene::addCylinder() void Scene::addCylinder()
{ {
float color[] = {1.0,0.0,0.0}; float color[] = {1.0,0.0,0.0};
ScenePrimitive *primitive = new ScenePrimitive(PrimitiveType::Cylinder,tesselation); ScenePrimitive *primitive = new ScenePrimitive(Cylinder,tesselation);
primitive->setMaterial(color); primitive->setMaterial(color);
addSceneObjectTaActive(primitive); addSceneObjectTaActive(primitive);
} }
...@@ -94,7 +94,7 @@ void Scene::addCylinder() ...@@ -94,7 +94,7 @@ void Scene::addCylinder()
void Scene::addTorus() void Scene::addTorus()
{ {
float color[] = {1.0,0.0,1.0}; float color[] = {1.0,0.0,1.0};
ScenePrimitive *primitive = new ScenePrimitive(PrimitiveType::Torus,tesselation); ScenePrimitive *primitive = new ScenePrimitive(Torus,tesselation);
primitive->setMaterial(color); primitive->setMaterial(color);
addSceneObjectTaActive(primitive); addSceneObjectTaActive(primitive);
} }
...@@ -102,7 +102,7 @@ void Scene::addTorus() ...@@ -102,7 +102,7 @@ void Scene::addTorus()
void Scene::addCone() void Scene::addCone()
{ {
float color[] = {0.0,1.0,1.0}; float color[] = {0.0,1.0,1.0};
ScenePrimitive *primitive = new ScenePrimitive(PrimitiveType::Cone,tesselation); ScenePrimitive *primitive = new ScenePrimitive(Cone,tesselation);
primitive->setMaterial(color); primitive->setMaterial(color);
addSceneObjectTaActive(primitive); addSceneObjectTaActive(primitive);
} }
......
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