Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
OpenFlipper-Free
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
23
Issues
23
List
Boards
Labels
Service Desk
Milestones
Merge Requests
5
Merge Requests
5
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenFlipper-Free
OpenFlipper-Free
Commits
f191b651
Commit
f191b651
authored
Nov 23, 2016
by
Christopher Tenter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add helper functions for shader based picking
parent
04e8f854
Pipeline
#3711
passed with stage
in 111 minutes and 20 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
1 deletion
+45
-1
ACG/GL/GLPrimitives.cc
ACG/GL/GLPrimitives.cc
+19
-0
ACG/GL/GLPrimitives.hh
ACG/GL/GLPrimitives.hh
+9
-1
ACG/GL/GLState.cc
ACG/GL/GLState.cc
+14
-0
ACG/GL/GLState.hh
ACG/GL/GLState.hh
+3
-0
No files found.
ACG/GL/GLPrimitives.cc
View file @
f191b651
...
...
@@ -229,6 +229,25 @@ void GLPrimitive::draw_primitive()
//------------------------------------------------------------------------
void
GLPrimitive
::
draw_primitive
(
GLSL
::
Program
*
_program
)
{
if
(
checkVBO
())
{
glBindBuffer
(
GL_ARRAY_BUFFER
,
vbo_
);
vertexDecl_
.
activateShaderPipeline
(
_program
);
if
(
numTris_
)
glDrawArrays
(
GL_TRIANGLES
,
0
,
numTris_
*
3
);
else
glDrawArrays
(
GL_LINES
,
0
,
numLines_
*
2
);
vertexDecl_
.
deactivateShaderPipeline
(
_program
);
glBindBuffer
(
GL_ARRAY_BUFFER
,
0
);
}
}
//------------------------------------------------------------------------
void
GLPrimitive
::
addToRenderer_primitive
(
class
IRenderer
*
_renderer
,
RenderObject
*
_ro
)
{
if
(
checkVBO
())
...
...
ACG/GL/GLPrimitives.hh
View file @
f191b651
...
...
@@ -80,9 +80,17 @@ public:
GLPrimitive
();
virtual
~
GLPrimitive
();
// bind vbo + gl draw call
// bind vbo + gl draw call (fixed function mode)
// use this function in compatibility profile
void
draw_primitive
();
// activate vertex declaration + gl draw call (shader mode)
// _program may be nullptr, in that case the attribute locations are as follows.
// 0 : float3 position
// 1 : float3 normal
// 2 : float2 texcoord
void
draw_primitive
(
GLSL
::
Program
*
_program
);
// add to deferred draw call to renderer
void
addToRenderer_primitive
(
class
IRenderer
*
_renderer
,
struct
RenderObject
*
_ro
);
...
...
ACG/GL/GLState.cc
View file @
f191b651
...
...
@@ -59,6 +59,7 @@
#include <ACG/GL/acg_glew.hh>
#include "GLState.hh"
#include <OpenMesh/Core/Utils/vector_cast.hh>
#include <cstring>
...
...
@@ -1070,6 +1071,19 @@ Vec4uc GLState::pick_get_name_color (size_t _idx)
//-----------------------------------------------------------------------------
Vec4f
GLState
::
pick_get_name_color_norm
(
unsigned
int
_idx
)
{
Vec4f
rv
(
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
);
if
(
colorPicking_
)
{
Vec4uc
color_abs
=
colorStack_
.
getIndexColor
(
_idx
);
rv
=
OpenMesh
::
vector_cast
<
Vec4f
,
Vec4uc
>
(
color_abs
)
/
255.0
f
;
}
return
rv
;
}
//-----------------------------------------------------------------------------
void
GLState
::
pick_push_name
(
size_t
_idx
)
{
colorStack_
.
pushIndex
(
_idx
);
...
...
ACG/GL/GLState.hh
View file @
f191b651
...
...
@@ -1114,6 +1114,9 @@ public:
/// for each primitive
Vec4uc
pick_get_name_color
(
size_t
_idx
);
/// same as pick_get_name_color, but the resulting color channels are normalized in [0.0, 1.0] range
Vec4f
pick_get_name_color_norm
(
unsigned
int
_idx
);
/// creates a new name the stack (like glPushName())
void
pick_push_name
(
size_t
_idx
);
...
...
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