Commit e5a95c53 by Kai Westerkamp

add Glut and Torus

parent fc71d062
...@@ -24,6 +24,9 @@ void Controler::mousePressed(GLView* view, QMouseEvent *event) ...@@ -24,6 +24,9 @@ void Controler::mousePressed(GLView* view, QMouseEvent *event)
void Controler::mouseMoveEvent(GLView* view, QMouseEvent *event) void Controler::mouseMoveEvent(GLView* view, QMouseEvent *event)
{ {
if(activeView != view)
qDebug()<<"Active view Change";
if (event->buttons() & Qt::LeftButton) { if (event->buttons() & Qt::LeftButton) {
rotate(trackballPoint(event->pos().x(),event->pos().y())); rotate(trackballPoint(event->pos().x(),event->pos().y()));
event->accept(); event->accept();
......
This diff is collapsed. Click to expand it.
...@@ -11,6 +11,9 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets ...@@ -11,6 +11,9 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = hellocube TARGET = hellocube
TEMPLATE = app TEMPLATE = app
LIBS += -lglut64
LIBS += -L$$PWD/glut
SOURCES += main.cpp\ SOURCES += main.cpp\
mainwindow.cpp \ mainwindow.cpp \
cubewidget.cpp \ cubewidget.cpp \
...@@ -30,7 +33,8 @@ HEADERS += mainwindow.h \ ...@@ -30,7 +33,8 @@ HEADERS += mainwindow.h \
camera.h \ camera.h \
sceneprimitive.h \ sceneprimitive.h \
sceneobject.h \ sceneobject.h \
scenenode.h scenenode.h \
glut.h
RESOURCES += \ RESOURCES += \
hellocube.qrc hellocube.qrc
......
...@@ -19,7 +19,7 @@ int Scene::simpleScene() ...@@ -19,7 +19,7 @@ int Scene::simpleScene()
moveActive(QVector3D(0,1.5,-1.5)); moveActive(QVector3D(0,1.5,-1.5));
addTorus(); addTorus();
moveActive(QVector3D(-1.5,0,0)); moveActive(QVector3D(0,0,-3));
addCone(); addCone();
moveActive(QVector3D(0,-1.5,-1.5)); moveActive(QVector3D(0,-1.5,-1.5));
......
...@@ -93,7 +93,7 @@ void ScenePrimitive::draw(){ ...@@ -93,7 +93,7 @@ void ScenePrimitive::draw(){
gluDisk( qobj, 0.0, radius, tesselation, 1); gluDisk( qobj, 0.0, radius, tesselation, 1);
break; break;
case Torus: case Torus:
// glutSolidTorus(5, 15, 8, 128); glutSolidTorus(1, 2, tesselation, tesselation);
break; break;
default: default:
qDebug()<<"Enum Error"; qDebug()<<"Enum Error";
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#define SCENEPRIMITIVE_H #define SCENEPRIMITIVE_H
#include <sceneobject.h> #include <sceneobject.h>
#include <glut.h>
enum PrimitiveType{Quader=0,Sphere,Cylinder,Torus,Cone}; enum PrimitiveType{Quader=0,Sphere,Cylinder,Torus,Cone};
......
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