Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
Unterteilungsalgorithmen
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
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
Unterteilungsalgorithmen
Commits
2aaf8beb
Commit
2aaf8beb
authored
Jun 15, 2016
by
Philipp Adolf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Load compute shader
parent
4eaf0e47
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
0 deletions
+38
-0
mainwidget.cpp
QTProject/mainwidget.cpp
+1
-0
resources.qrc
QTProject/resources.qrc
+1
-0
subdivision.compute
QTProject/subdivision.compute
+5
-0
subdivision.cpp
QTProject/subdivision.cpp
+28
-0
subdivision.h
QTProject/subdivision.h
+3
-0
No files found.
QTProject/mainwidget.cpp
View file @
2aaf8beb
...
@@ -107,6 +107,7 @@ void MainWidget::initializeGL(){
...
@@ -107,6 +107,7 @@ void MainWidget::initializeGL(){
// Shader
// Shader
subdevisionShader
=
initShaderProgram
();
subdevisionShader
=
initShaderProgram
();
subdivision
->
init
();
//loadNewMesh( "../Models/demon_head.3ds");
//loadNewMesh( "../Models/demon_head.3ds");
loadNewMesh
(
"../Models/box.obj"
);
loadNewMesh
(
"../Models/box.obj"
);
}
}
...
...
QTProject/resources.qrc
View file @
2aaf8beb
...
@@ -5,5 +5,6 @@
...
@@ -5,5 +5,6 @@
<file>subdivide.tcs</file>
<file>subdivide.tcs</file>
<file>subdivide.tes</file>
<file>subdivide.tes</file>
<file>subdivide.vert</file>
<file>subdivide.vert</file>
<file>subdivision.compute</file>
</qresource>
</qresource>
</RCC>
</RCC>
QTProject/subdivision.compute
0 → 100644
View file @
2aaf8beb
#version 430
layout (local_size_x = 1) in;
void main() {
}
QTProject/subdivision.cpp
View file @
2aaf8beb
...
@@ -7,6 +7,34 @@ Subdivision::Subdivision(QOpenGLFunctions_4_3_Core *f)
...
@@ -7,6 +7,34 @@ Subdivision::Subdivision(QOpenGLFunctions_4_3_Core *f)
Subdivision
::~
Subdivision
()
Subdivision
::~
Subdivision
()
{
{
delete
shader
;
}
void
Subdivision
::
init
()
{
shader
=
initComputeShaderProgram
();
}
QOpenGLShaderProgram
*
Subdivision
::
initComputeShaderProgram
(){
QString
source
=
QLatin1String
(
":/subdivision.compute"
);
qDebug
()
<<
"Compiling compute shader ..."
;
QOpenGLShader
*
computeShader
=
new
QOpenGLShader
(
QOpenGLShader
::
Compute
);
if
(
!
computeShader
->
compileSourceFile
(
source
)){
qCritical
()
<<
"Compute Shader"
<<
source
<<
"failed"
<<
computeShader
->
log
();
exit
(
5
);
}
qDebug
()
<<
"Adding compute shader ..."
;
QOpenGLShaderProgram
*
shader
=
new
QOpenGLShaderProgram
();
shader
->
addShader
(
computeShader
);
qDebug
()
<<
"Linking compute shader ..."
;
if
(
!
shader
->
link
()){
qCritical
()
<<
"Linking compute shader failed:"
<<
shader
->
log
();
exit
(
5
);
}
qDebug
()
<<
"Linking compute shader done"
;
return
shader
;
}
}
Mesh
*
Subdivision
::
subdivide
(
Mesh
*
mesh
)
{
Mesh
*
Subdivision
::
subdivide
(
Mesh
*
mesh
)
{
...
...
QTProject/subdivision.h
View file @
2aaf8beb
...
@@ -12,11 +12,14 @@ public:
...
@@ -12,11 +12,14 @@ public:
Subdivision
(
QOpenGLFunctions_4_3_Core
*
f
);
Subdivision
(
QOpenGLFunctions_4_3_Core
*
f
);
~
Subdivision
();
~
Subdivision
();
void
init
();
Mesh
*
subdivide
(
Mesh
*
mesh
);
Mesh
*
subdivide
(
Mesh
*
mesh
);
private
:
private
:
QOpenGLFunctions_4_3_Core
*
f
;
QOpenGLFunctions_4_3_Core
*
f
;
QOpenGLShaderProgram
*
shader
;
QOpenGLShaderProgram
*
initComputeShaderProgram
();
void
precomputeTables
(
Mesh
*
mesh
);
void
precomputeTables
(
Mesh
*
mesh
);
void
runShader
(
Mesh
*
mesh
);
void
runShader
(
Mesh
*
mesh
);
};
};
...
...
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