Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenFlipper-Free
OpenFlipper-Free
Commits
64af9513
Commit
64af9513
authored
Nov 25, 2016
by
Christopher Tenter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use ACG:GeometryBuffer instead of direct opengl vbo
parent
3bf20e8f
Pipeline
#3734
passed with stage
in 60 minutes and 14 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
13 deletions
+12
-13
ObjectTypes/PolyLine/PolyLineNodeT.cc
ObjectTypes/PolyLine/PolyLineNodeT.cc
+1
-0
ObjectTypes/PolyLineCollection/PolyLineCollectionNodeT.cc
ObjectTypes/PolyLineCollection/PolyLineCollectionNodeT.cc
+5
-11
ObjectTypes/PolyLineCollection/PolyLineCollectionNodeT.hh
ObjectTypes/PolyLineCollection/PolyLineCollectionNodeT.hh
+6
-2
No files found.
ObjectTypes/PolyLine/PolyLineNodeT.cc
View file @
64af9513
...
...
@@ -766,6 +766,7 @@ updateVBO() {
// Move data to the buffer in gpu memory
vbo_
.
upload
(
bufferSize
,
&
vboData
[
0
],
GL_STATIC_DRAW
);
vbo_
.
unbind
();
}
// Index buffer for selected vertices
...
...
ObjectTypes/PolyLineCollection/PolyLineCollectionNodeT.cc
View file @
64af9513
...
...
@@ -86,7 +86,6 @@ template <class PolyLineCollection>
PolyLineCollectionNodeT
<
PolyLineCollection
>::
PolyLineCollectionNodeT
(
PolyLineCollection
&
_pl
,
BaseNode
*
_parent
,
std
::
string
_name
)
:
BaseNode
(
_parent
,
_name
),
polyline_collection_
(
_pl
),
vbo_
(
0
),
updateVBO_
(
true
),
sphere_
(
0
),
total_vertex_count_
(
0
)
...
...
@@ -149,7 +148,7 @@ draw(GLState& _state, const DrawModes::DrawMode& _drawMode)
ACG
::
GLState
::
disable
(
GL_TEXTURE_2D
);
// Bind the vertex array
ACG
::
GLState
::
bindBuffer
(
GL_ARRAY_BUFFER_ARB
,
vbo_
);
vbo_
.
bind
(
);
vertexDecl_
.
activateFixedFunction
();
ACG
::
Vec4f
color
=
_state
.
ambient_color
()
+
_state
.
diffuse_color
();
...
...
@@ -267,7 +266,7 @@ pick(GLState& _state, PickTarget _target)
if
(
polyline_collection_
.
n_polylines
()
==
0
)
return
;
ACG
::
GLState
::
bindBuffer
(
GL_ARRAY_BUFFER_ARB
,
vbo_
);
vbo_
.
bind
(
);
vertexDecl_
.
activateFixedFunction
();;
_state
.
pick_set_maximum
(
2
);
...
...
@@ -361,10 +360,6 @@ updateVBO() {
// We always output vertex positions
vertexDecl_
.
addElement
(
GL_FLOAT
,
3
,
ACG
::
VERTEX_USAGE_POSITION
);
// create vbo if it does not exist
if
(
!
vbo_
)
GLState
::
genBuffersARB
(
1
,
&
vbo_
);
// size in bytes of vbo, create additional vertex for closed loop indexing
unsigned
int
bufferSize
=
vertexDecl_
.
getVertexStride
()
*
offset
;
...
...
@@ -386,9 +381,8 @@ updateVBO() {
}
// Move data to the buffer in gpu memory
GLState
::
bindBufferARB
(
GL_ARRAY_BUFFER_ARB
,
vbo_
);
GLState
::
bufferDataARB
(
GL_ARRAY_BUFFER_ARB
,
bufferSize
,
vboData_
,
GL_STATIC_DRAW_ARB
);
GLState
::
bindBufferARB
(
GL_ARRAY_BUFFER_ARB
,
0
);
vbo_
.
upload
(
bufferSize
,
vboData_
,
GL_STATIC_DRAW
);
vbo_
.
unbind
();
// Remove the local storage
delete
[]
vboData_
;
...
...
@@ -439,7 +433,7 @@ getRenderObjects(ACG::IRenderer* _renderer, ACG::GLState& _state , const ACG::S
updateVBO
();
// Set to the right vbo
ro
.
vertexBuffer
=
vbo_
;
ro
.
vertexBuffer
=
vbo_
.
id
()
;
// decl must be static or member, renderer does not make a copy
ro
.
vertexDecl
=
&
vertexDecl_
;
...
...
ObjectTypes/PolyLineCollection/PolyLineCollectionNodeT.hh
View file @
64af9513
...
...
@@ -58,6 +58,8 @@
#include <ACG/GL/VertexDeclaration.hh>
#include <ACG/GL/IRenderer.hh>
#include <ACG/GL/GLPrimitives.hh>
#include <ACG/GL/globjects.hh>
#include <ObjectTypes/PolyLine/PolyLineNodeT.hh>
//== FORWARDDECLARATIONS ======================================================
...
...
@@ -117,7 +119,7 @@ public:
void
getRenderObjects
(
ACG
::
IRenderer
*
_renderer
,
ACG
::
GLState
&
_state
,
const
ACG
::
SceneGraph
::
DrawModes
::
DrawMode
&
_drawMode
,
const
ACG
::
SceneGraph
::
Material
*
_mat
);
/// Trigger an update of the vbo
void
update
()
{
updateVBO_
=
true
;
}
;
void
update
()
{
updateVBO_
=
true
;
}
void
resetVBO
()
{
offsets_
.
clear
();}
private:
...
...
@@ -151,7 +153,7 @@ private:
PolyLineCollection
&
polyline_collection_
;
/// VBO used to render the poly line
unsigned
int
vbo_
;
GeometryBuffer
vbo_
;
/// Flag to trigger update of vbo
bool
updateVBO_
;
...
...
@@ -161,6 +163,8 @@ private:
std
::
vector
<
std
::
pair
<
size_t
,
size_t
>
>
offsets_
;
std
::
vector
<
PolyLineNodeT
<
typename
PolyLineCollection
::
PolyLine
>
>
polylineNodes_
;
size_t
total_vertex_count_
;
};
...
...
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