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
cd0b6201
Commit
cd0b6201
authored
Jan 17, 2016
by
Kai Westerkamp
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
ssh://git.breab.org:2223/kai/GraPa
parents
5de04035
656aab6e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
42 deletions
+48
-42
mainwidget.cpp
A5/Animation/mainwidget.cpp
+46
-40
mainwidget.h
A5/Animation/mainwidget.h
+2
-2
No files found.
A5/Animation/mainwidget.cpp
View file @
cd0b6201
...
@@ -2,7 +2,12 @@
...
@@ -2,7 +2,12 @@
MainWidget
::
MainWidget
()
MainWidget
::
MainWidget
()
{
{
QSurfaceFormat
format
;
format
.
setDepthBufferSize
(
24
);
format
.
setStencilBufferSize
(
8
);
format
.
setVersion
(
2
,
1
);
format
.
setProfile
(
QSurfaceFormat
::
CoreProfile
);
setFormat
(
format
);
}
}
QSize
MainWidget
::
minimumSizeHint
()
const
QSize
MainWidget
::
minimumSizeHint
()
const
...
@@ -34,43 +39,43 @@ void MainWidget::initializeGL(){
...
@@ -34,43 +39,43 @@ void MainWidget::initializeGL(){
//temp
//temp
static
const
GLfloat
g_vertex_buffer_data
[]
=
{
static
const
GLfloat
g_vertex_buffer_data
[]
=
{
-
1.0
f
,
-
1.0
f
,
-
1.0
f
,
-
1.0
f
,
-
1.0
f
,
-
1.0
f
,
-
1.0
f
,
-
1.0
f
,
1.0
f
,
-
1.0
f
,
-
1.0
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0
f
,
1.0
f
,
1.0
f
,
-
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
,
-
1.0
f
,
-
1.0
f
,
1.0
f
,
-
1.0
f
,
-
1.0
f
,
1.0
f
,
1.0
f
,
-
1.0
f
,
1.0
f
,
1.0
f
,
-
1.0
f
,
1.0
f
,
-
1.0
f
,
-
1.0
f
,
1.0
f
,
-
1.0
f
,
-
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
,
-
1.0
f
,
1.0
f
,
1.0
f
,
-
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
,
-
1.0
f
,
1.0
f
,
1.0
f
,
-
1.0
f
,
-
1.0
f
,
1.0
f
,
-
1.0
f
,
-
1.0
f
,
1.0
f
,
-
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
,
-
1.0
f
,
1.0
f
,
-
1.0
f
,
-
1.0
f
,
1.0
f
,
-
1.0
f
,
-
1.0
f
,
1.0
f
,
1.0
f
,
-
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
,
-
1.0
f
,
1.0
f
,
1.0
f
,
-
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
,
-
1.0
f
,
1.0
f
1.0
f
,
-
1.0
f
,
1.0
f
};
};
...
@@ -90,7 +95,7 @@ QOpenGLShaderProgram* MainWidget::initShader(QString fragSource, QString vertSou
...
@@ -90,7 +95,7 @@ QOpenGLShaderProgram* MainWidget::initShader(QString fragSource, QString vertSou
QOpenGLShader
*
frag
=
new
QOpenGLShader
(
QOpenGLShader
::
Fragment
);
QOpenGLShader
*
frag
=
new
QOpenGLShader
(
QOpenGLShader
::
Fragment
);
if
(
!
frag
->
compileSourceFile
(
fragSource
)){
if
(
!
frag
->
compileSourceFile
(
fragSource
)){
qCritical
()
<<
"Fragment Shader"
<<
fragSource
<<
"failed"
<<
frag
->
log
();
qCritical
()
<<
"Fragment Shader"
<<
fragSource
<<
"failed"
<<
frag
->
log
();
exit
(
5
);
exit
(
5
);
}
}
QOpenGLShaderProgram
*
shader
=
new
QOpenGLShaderProgram
();
QOpenGLShaderProgram
*
shader
=
new
QOpenGLShaderProgram
();
...
@@ -98,7 +103,7 @@ QOpenGLShaderProgram* MainWidget::initShader(QString fragSource, QString vertSou
...
@@ -98,7 +103,7 @@ QOpenGLShaderProgram* MainWidget::initShader(QString fragSource, QString vertSou
shader
->
addShader
(
frag
);
shader
->
addShader
(
frag
);
if
(
!
shader
->
link
()){
if
(
!
shader
->
link
()){
qCritical
()
<<
"Linking shader failed:"
<<
shader
->
log
();
qCritical
()
<<
"Linking shader failed:"
<<
shader
->
log
();
exit
(
5
);
exit
(
5
);
}
}
return
shader
;
return
shader
;
...
@@ -107,6 +112,7 @@ QOpenGLShaderProgram* MainWidget::initShader(QString fragSource, QString vertSou
...
@@ -107,6 +112,7 @@ QOpenGLShaderProgram* MainWidget::initShader(QString fragSource, QString vertSou
void
MainWidget
::
paintGL
(){
void
MainWidget
::
paintGL
(){
glViewport
(
0
,
0
,
width
(),
height
());
glViewport
(
0
,
0
,
width
(),
height
());
qDebug
()
<<
"Format"
<<
this
->
format
().
version
();
glClear
(
GL_COLOR_BUFFER_BIT
|
GL_DEPTH_BUFFER_BIT
);
glClear
(
GL_COLOR_BUFFER_BIT
|
GL_DEPTH_BUFFER_BIT
);
...
...
A5/Animation/mainwidget.h
View file @
cd0b6201
...
@@ -4,10 +4,10 @@
...
@@ -4,10 +4,10 @@
#include <QObject>
#include <QObject>
#include <QtOpenGL>
#include <QtOpenGL>
#include <QOpenGLWidget>
#include <QOpenGLWidget>
#include <QOpenGLFunctions_
3_3_Core
>
#include <QOpenGLFunctions_
2_1
>
#include <QOpenGLShaderProgram>
#include <QOpenGLShaderProgram>
class
MainWidget
:
public
QOpenGLWidget
,
public
QOpenGLFunctions_
3_3_Core
class
MainWidget
:
public
QOpenGLWidget
,
public
QOpenGLFunctions_
2_1
{
{
Q_OBJECT
Q_OBJECT
public
:
public
:
...
...
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