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