Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
RoboGuide
scigl_render
Commits
d1e4fd9b
Commit
d1e4fd9b
authored
Mar 04, 2019
by
Tim Übelhör
Browse files
several addition for binding resources
parent
e1f59e02
Changes
6
Hide whitespace changes
Inline
Side-by-side
include/scigl_render/buffer/texture2d.hpp
View file @
d1e4fd9b
...
...
@@ -15,6 +15,13 @@ public:
/** activates texture_n for use in shaders */
static
void
activate
(
GLenum
texture_n
);
/**
* bind this texture to an image unit for imageLoad
* \param unit the binding unit
* \param access GL_READ_ONLY, GL_WRITE_ONLY, or GL_READ_WRITE
*/
void
bind_image_unit
(
GLuint
unit
,
GLenum
access
)
const
;
/** binds this texture to GL_TEXTURE_2D */
void
bind
()
const
;
...
...
include/scigl_render/render/depth_simulator.hpp
View file @
d1e4fd9b
...
...
@@ -26,11 +26,11 @@ public:
int
get_height
();
// the OpenGL texture needed to render depth values
static
const
GLenum
FORMAT
=
GL_RED
;
static
const
GLenum
TYPE
=
GL_FLOAT
;
static
const
GL
int
INTERNAL_FORMAT
=
GL_R32F
;
static
const
size_t
CHANNELS
=
1
;
static
const
size_t
PIXEL_SIZE
=
CHANNELS
*
sizeof
(
GLfloat
)
;
static
const
GLenum
FORMAT
;
static
const
GLenum
TYPE
;
static
const
GL
enum
INTERNAL_FORMAT
;
static
const
size_t
CHANNELS
;
static
const
size_t
PIXEL_SIZE
;
private:
// where and how to render
...
...
include/scigl_render/render/rasterizer.hpp
View file @
d1e4fd9b
...
...
@@ -42,13 +42,13 @@ public:
size_t
views_per_column
);
/** activate a view by its 2D coordinates */
void
activate_view
(
size_t
row
,
size_t
column
);
void
activate_view
(
size_t
row
,
size_t
column
)
const
;
/** as if the rows were concatenated */
void
activate_view
(
size_t
view
);
void
activate_view
(
size_t
view
)
const
;
/** activate the whole texture view, for example when clearing it */
void
activate_all
();
void
activate_all
()
const
;
/**
* Minimal raster size for the given number of views
...
...
src/buffer/texture2d.cpp
View file @
d1e4fd9b
...
...
@@ -55,6 +55,11 @@ void Texture2D::bind() const
glBindTexture
(
GL_TEXTURE_2D
,
texture
);
}
void
Texture2D
::
bind_image_unit
(
GLuint
unit
,
GLenum
access
)
const
{
glBindImageTexture
(
unit
,
texture
,
0
,
GL_FALSE
,
0
,
access
,
internal_format
);
}
void
Texture2D
::
unbind
()
const
{
glBindTexture
(
GL_TEXTURE_2D
,
0
);
...
...
src/render/depth_simulator.cpp
View file @
d1e4fd9b
...
...
@@ -4,6 +4,12 @@
namespace
scigl_render
{
const
GLenum
DepthSimulator
::
FORMAT
=
GL_RED
;
const
GLenum
DepthSimulator
::
TYPE
=
GL_FLOAT
;
const
GLenum
DepthSimulator
::
INTERNAL_FORMAT
=
GL_R32F
;
const
size_t
DepthSimulator
::
CHANNELS
=
1
;
const
size_t
DepthSimulator
::
PIXEL_SIZE
=
CHANNELS
*
sizeof
(
GLfloat
);
DepthSimulator
::
DepthSimulator
(
scigl_render
::
CvCamera
camera
,
scigl_render
::
Model
model
)
:
camera
(
std
::
move
(
camera
)),
...
...
src/render/rasterizer.cpp
View file @
d1e4fd9b
...
...
@@ -17,14 +17,14 @@ Rasterizer::Rasterizer(size_t width, size_t height, size_t views_per_row,
set_views_per_column
(
views_per_column
);
}
void
Rasterizer
::
activate_view
(
size_t
row
,
size_t
column
)
void
Rasterizer
::
activate_view
(
size_t
row
,
size_t
column
)
const
{
auto
xy
=
view_xy
(
row
,
column
);
glScissor
(
xy
.
first
,
xy
.
second
,
width
,
height
);
glViewport
(
xy
.
first
,
xy
.
second
,
width
,
height
);
}
void
Rasterizer
::
activate_view
(
size_t
view
)
void
Rasterizer
::
activate_view
(
size_t
view
)
const
{
auto
position
=
view_position
(
view
);
size_t
row
=
position
.
first
;
...
...
@@ -32,7 +32,7 @@ void Rasterizer::activate_view(size_t view)
activate_view
(
position
.
first
,
position
.
second
);
}
void
Rasterizer
::
activate_all
()
void
Rasterizer
::
activate_all
()
const
{
glScissor
(
0
,
0
,
texture_width
,
texture_height
);
glViewport
(
0
,
0
,
texture_width
,
texture_height
);
...
...
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