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
1c7fdb0d
Commit
1c7fdb0d
authored
Jun 29, 2016
by
Philipp Adolf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add offset into output buffer for edge shader
parent
ffaac38b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
subdivision.cpp
QTProject/subdivision.cpp
+5
-4
subdivision.h
QTProject/subdivision.h
+1
-1
No files found.
QTProject/subdivision.cpp
View file @
1c7fdb0d
...
...
@@ -334,14 +334,15 @@ void Subdivision::runShader(Input input, Tables &tables) {
f
->
glBindBuffer
(
GL_SHADER_STORAGE_BUFFER
,
0
);
runEdgeShader
(
tables
.
edge_indices
.
size
()
/
4
,
input
.
vb_handle
,
edge_indices_handle
,
output_handle
);
int
edgeOffset
=
input
.
vertex_buffer
.
size
();
runEdgeShader
(
tables
.
edge_indices
.
size
()
/
4
,
input
.
vb_handle
,
edge_indices_handle
,
output_handle
,
edgeOffset
);
// Map the output buffer so we can read the results
f
->
glBindBuffer
(
GL_SHADER_STORAGE_BUFFER
,
output_handle
);
Vertex
*
ptr
;
ptr
=
(
Vertex
*
)
f
->
glMapBuffer
(
GL_SHADER_STORAGE_BUFFER
,
GL_WRITE_ONLY
);
for
(
int
i
=
0
;
i
<
tables
.
edge_indices
.
size
()
/
4
;
i
++
)
{
qDebug
()
<<
ptr
[
i
].
pos
;
qDebug
()
<<
ptr
[
edgeOffset
+
i
].
pos
;
}
f
->
glUnmapBuffer
(
GL_SHADER_STORAGE_BUFFER
);
...
...
@@ -350,12 +351,12 @@ void Subdivision::runShader(Input input, Tables &tables) {
f
->
glDeleteBuffers
(
1
,
&
output_handle
);
}
void
Subdivision
::
runEdgeShader
(
GLuint
size
,
GLuint
vb_handle
,
GLuint
edge_indices_handle
,
GLuint
output_handle
)
{
void
Subdivision
::
runEdgeShader
(
GLuint
size
,
GLuint
vb_handle
,
GLuint
edge_indices_handle
,
GLuint
output_handle
,
GLuint
offset
)
{
edgeShader
->
bind
();
f
->
glBindBufferBase
(
GL_SHADER_STORAGE_BUFFER
,
0
,
vb_handle
);
f
->
glBindBufferBase
(
GL_SHADER_STORAGE_BUFFER
,
1
,
edge_indices_handle
);
f
->
glBindBuffer
Base
(
GL_SHADER_STORAGE_BUFFER
,
2
,
output_handle
);
f
->
glBindBuffer
Range
(
GL_SHADER_STORAGE_BUFFER
,
2
,
output_handle
,
offset
*
sizeof
(
Vertex
),
size
*
sizeof
(
Vertex
)
);
// Run the shader
f
->
glDispatchCompute
(
size
,
1
,
1
);
...
...
QTProject/subdivision.h
View file @
1c7fdb0d
...
...
@@ -38,7 +38,7 @@ private:
QOpenGLShaderProgram
*
initComputeShaderProgram
(
QString
&
source
);
Tables
precomputeTables
(
Input
input
);
void
runShader
(
Input
input
,
Tables
&
tables
);
void
runEdgeShader
(
GLuint
size
,
GLuint
vb_handle
,
GLuint
edge_indices_handle
,
GLuint
output_handle
);
void
runEdgeShader
(
GLuint
size
,
GLuint
vb_handle
,
GLuint
edge_indices_handle
,
GLuint
output_handle
,
GLuint
offset
);
};
#endif
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