Commit 03b4c0ce by Kai Westerkamp

laptop

parent ee021a83
...@@ -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;
...@@ -14,6 +15,8 @@ GLView::GLView(Scene *scene,Camera * camera,Controler *controler ) ...@@ -14,6 +15,8 @@ GLView::GLView(Scene *scene,Camera * camera,Controler *controler )
isGridEnabled = false; isGridEnabled = false;
MIP = false; MIP = false;
afterInit = false; afterInit = false;
} }
QSize GLView::minimumSizeHint() const QSize GLView::minimumSizeHint() const
...@@ -28,6 +31,10 @@ QSize GLView::sizeHint() const ...@@ -28,6 +31,10 @@ QSize GLView::sizeHint() const
void GLView::initializeGL ( ) { void GLView::initializeGL ( ) {
qDebug() << "Current Context:" << this->format();
Q_ASSERT(initializeOpenGLFunctions()); Q_ASSERT(initializeOpenGLFunctions());
glClearColor(0.0, 0.0, 0.0, 0.0); glClearColor(0.0, 0.0, 0.0, 0.0);
......
...@@ -9,9 +9,9 @@ ...@@ -9,9 +9,9 @@
#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>
class GLView : public QGLWidget, public QOpenGLFunctions_4_3_Core class GLView : public QGLWidget, public QOpenGLFunctions_4_0_Core
{ {
Q_OBJECT Q_OBJECT
protected : protected :
...@@ -32,7 +32,7 @@ public slots: ...@@ -32,7 +32,7 @@ public slots:
void setMIP(bool mip); void setMIP(bool mip);
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\
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.5.1, 2015-12-18T10:06:19. --> <!-- Written by QtCreator 3.5.1, 2015-12-26T22:25:30. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>
<value type="QByteArray">{6caf6096-6900-4b02-8e0b-a6f627b8fa95}</value> <value type="QByteArray">{0470353d-87ed-48b4-99a7-d60a51e7a2d3}</value>
</data> </data>
<data> <data>
<variable>ProjectExplorer.Project.ActiveTarget</variable> <variable>ProjectExplorer.Project.ActiveTarget</variable>
...@@ -58,14 +58,14 @@ ...@@ -58,14 +58,14 @@
<data> <data>
<variable>ProjectExplorer.Project.Target.0</variable> <variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap"> <valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.4.2 MSVC2013 OpenGL 64bit</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.4.2 MinGW 32bit2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.4.2 MSVC2013 OpenGL 64bit</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.4.2 MinGW 32bit2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.54.win64_msvc2013_64_opengl_kit</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.54.win32_mingw491_kit</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:/Projekte/GraPa/build-hellocube-Desktop_Qt_5_4_2_MSVC2013_OpenGL_64bit-Debug</value> <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Projekte/GraPa/build-hellocube-Desktop_Qt_5_4_2_MinGW_32bit2-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap> </valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Bereinigen</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap> </valuemap>
...@@ -120,7 +120,7 @@ ...@@ -120,7 +120,7 @@
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap> </valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1"> <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:/Projekte/GraPa/build-hellocube-Desktop_Qt_5_4_2_MSVC2013_OpenGL_64bit-Release</value> <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Projekte/GraPa/build-hellocube-Desktop_Qt_5_4_2_MinGW_32bit2-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
...@@ -161,7 +161,7 @@ ...@@ -161,7 +161,7 @@
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap> </valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Bereinigen</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap> </valuemap>
...@@ -178,12 +178,12 @@ ...@@ -178,12 +178,12 @@
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deployment</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap> </valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Lokales Deployment</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap> </valuemap>
...@@ -228,7 +228,7 @@ ...@@ -228,7 +228,7 @@
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">hellocube</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">hellocube</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:D:/Projekte/GraPa/A4/hellocube.pro</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/Projekte/GraPa/A4/hellocube.pro</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">hellocube.pro</value> <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">hellocube.pro</value>
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
......
...@@ -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