Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
GraPa
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kai Westerkamp
GraPa
Commits
1cae4594
Commit
1cae4594
authored
Jan 18, 2016
by
Kai Westerkamp
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
ssh://git.breab.org:2223/kai/GraPa
# Conflicts: # A4/hellocube.pro.user
parents
dac45821
5d3de742
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
16 deletions
+30
-16
.gitignore
.gitignore
+5
-2
glview.cpp
A4/glview.cpp
+6
-1
glview.h
A4/glview.h
+3
-3
hellocube.pro
A4/hellocube.pro
+3
-1
mainwindow.cpp
A4/mainwindow.cpp
+8
-4
scene.cpp
A4/scene.cpp
+5
-5
No files found.
.gitignore
View file @
1cae4594
/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
A4/glview.cpp
View file @
1cae4594
...
...
@@ -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
();
...
...
A4/glview.h
View file @
1cae4594
...
...
@@ -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
);
...
...
A4/hellocube.pro
View file @
1cae4594
...
...
@@ -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
\
...
...
A4/mainwindow.cpp
View file @
1cae4594
...
...
@@ -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
;
...
...
A4/scene.cpp
View file @
1cae4594
...
...
@@ -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
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment