NVIDIA DeepStream SDK API Reference

9.2 Release
sources/libs/ds3d/glprocess/gl_render_ctx.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef DS3D_GLPROCESS_GL_RENDER_CTX_H
19 #define DS3D_GLPROCESS_GL_RENDER_CTX_H
20 
21 #include "ds3d/common/common.h"
22 #include "ds3d/common/hpp/datamap.hpp"
23 #include "ds3d/common/hpp/frame.hpp"
24 #include "ds3d/glprocess/window.h"
25 
26 namespace ds3d { namespace gl {
27 
28 class iGLRender {
29 public:
30  iGLRender() = default;
31  virtual ~iGLRender() = default;
32 
33  virtual void setWindow(GuardGlWindow w) = 0;
34  virtual GuardGlWindow getWindow() = 0;
35  virtual ErrCode initResource() = 0;
36  virtual ErrCode uploadData(GuardDataMap datamap) = 0;
37  virtual ErrCode syncData() = 0;
38  virtual ErrCode draw(GuardDataMap datamap) = 0;
39  virtual ErrCode deinitResource() = 0;
40 
41  // add another interface to decouple renders and make it scalable
42  // <configure> should be called before <initResource>
43  virtual ErrCode configure(const char* yamlConfig, uint32_t size) { return ErrCode::kGood; }
44  // flush temporary data
45  virtual ErrCode flush() { return ErrCode::kGood; }
46 };
47 
48 struct WindowInfo {
49  uint32_t width = 0;
50  uint32_t height = 0;
51  std::string title;
52 };
53 
54 class BaseRender : public iGLRender {
55 public:
56  void setWindow(GuardGlWindow w) override { _window = std::move(w); }
57  GuardGlWindow getWindow() override { return _window; }
58  ErrCode syncData() override { return ErrCode::kGood; }
59 
60 protected:
62 };
63 
64 class DepthRender : public BaseRender {
65 public:
66  virtual void setDepthRange(float min, float max) = 0;
67  virtual void setDepthColor(const vec3b& minDepthColor, const vec3b& maxDepthColor) = 0;
68 };
69 
70 class PointCloudRender : public BaseRender {
71 public:
72  virtual void setModelMat(const std::vector<vec4f>& mat) = 0;
73  virtual void setViewMat(const std::vector<vec4f>& mat) = 0;
74  virtual void setLookAt(const vec3f& positon, const vec3f& target, const vec3f& up) = 0;
75  virtual void setPerspectiveMat(const std::vector<vec4f>& mat) = 0;
76  virtual void setPerspective(float degree, float ratio, float near, float far) = 0;
77  virtual void setTexCoordY(bool opposite) = 0;
78  virtual void setPositiveZOnly(bool enable) = 0;
79  virtual void setElementSize(uint32_t elements) = 0;
80  virtual void setPointsDataKey(const std::string& key) {}
81  virtual void set3DBboxKey(const std::string& key) {}
82  virtual void setLidarDataColor(const vec3b& color) {}
83  virtual void setMaxPoints(uint32_t num) {}
84  virtual void setMaxBboxes(uint32_t num) {}
85  virtual void enableLabels(bool flag) {}
86 };
87 
88 }} // namespace ds3d::gl
89 
92  bool enableVideo, bool enableDepth);
96  const char* yamlConfig, uint32_t size);
97 
99 
100 #endif // DS3D_GLPROCESS_GL_RENDER_CTX_H
ds3d::gl::WindowInfo::title
std::string title
Definition: sources/libs/ds3d/glprocess/gl_render_ctx.h:51
ds3d::gl::WindowInfo::height
uint32_t height
Definition: sources/libs/ds3d/glprocess/gl_render_ctx.h:50
ds3d::__xyz
Definition: includes/ds3d/common/idatatype.h:39
ds3d::gl::iGLRender::iGLRender
iGLRender()=default
ds3d::gl::BaseRender::syncData
ErrCode syncData() override
Definition: sources/libs/ds3d/glprocess/gl_render_ctx.h:58
ds3d::gl::iGLRender::getWindow
virtual GuardGlWindow getWindow()=0
ds3d::gl::BaseRender::setWindow
void setWindow(GuardGlWindow w) override
Definition: sources/libs/ds3d/glprocess/gl_render_ctx.h:56
ds3d::ErrCode::kGood
@ kGood
ds3d::gl::PointCloudRender::enableLabels
virtual void enableLabels(bool flag)
Definition: sources/libs/ds3d/glprocess/gl_render_ctx.h:85
ds3d::gl::PointCloudRender::setMaxPoints
virtual void setMaxPoints(uint32_t num)
Definition: sources/libs/ds3d/glprocess/gl_render_ctx.h:83
ds3d::gl::PointCloudRender::setPositiveZOnly
virtual void setPositiveZOnly(bool enable)=0
ds3d::gl::iGLRender::configure
virtual ErrCode configure(const char *yamlConfig, uint32_t size)
Definition: sources/libs/ds3d/glprocess/gl_render_ctx.h:43
ds3d::gl::PointCloudRender::set3DBboxKey
virtual void set3DBboxKey(const std::string &key)
Definition: sources/libs/ds3d/glprocess/gl_render_ctx.h:81
ds3d::gl::BaseRender
Definition: sources/libs/ds3d/glprocess/gl_render_ctx.h:54
ds3d::gl::iGLRender::initResource
virtual ErrCode initResource()=0
NvDs3D_CreatePointCloudRender
DS3D_EXPORT_API ds3d::gl::PointCloudRender * NvDs3D_CreatePointCloudRender()
ds3d::gl::PointCloudRender::setPointsDataKey
virtual void setPointsDataKey(const std::string &key)
Definition: sources/libs/ds3d/glprocess/gl_render_ctx.h:80
ds3d::gl::PointCloudRender
Definition: sources/libs/ds3d/glprocess/gl_render_ctx.h:70
ds3d::ErrCode
ErrCode
Definition: includes/ds3d/common/common.h:47
ds3d::gl::BaseRender::getWindow
GuardGlWindow getWindow() override
Definition: sources/libs/ds3d/glprocess/gl_render_ctx.h:57
ds3d::gl::PointCloudRender::setPerspectiveMat
virtual void setPerspectiveMat(const std::vector< vec4f > &mat)=0
ds3d::GuardDataT< gl::Window >
max
int max(int a, int b)
Compute the component-wise maximum.
Definition: sources/libs/nvmultiobjecttracker/include/modules/cuDCFv2/helper_math.h:60
DS3D_EXTERN_C_BEGIN
#define DS3D_EXTERN_C_BEGIN
Definition: includes/ds3d/common/defines.h:130
ds3d::gl::PointCloudRender::setViewMat
virtual void setViewMat(const std::vector< vec4f > &mat)=0
ds3d::gl::iGLRender::setWindow
virtual void setWindow(GuardGlWindow w)=0
NvDs3D_CreateTexture3DRender
DS3D_EXPORT_API ds3d::gl::iGLRender * NvDs3D_CreateTexture3DRender(const char *yamlConfig, uint32_t size)
absl::move
constexpr absl::OTABSL_OPTION_NAMESPACE_NAME::remove_reference_t< T > && move(T &&t) noexcept
Definition: includes/opentelemetry/nostd/internal/absl/utility/utility.h:199
ds3d::gl::PointCloudRender::setModelMat
virtual void setModelMat(const std::vector< vec4f > &mat)=0
ds3d::gl::iGLRender::uploadData
virtual ErrCode uploadData(GuardDataMap datamap)=0
ds3d::gl::PointCloudRender::setMaxBboxes
virtual void setMaxBboxes(uint32_t num)
Definition: sources/libs/ds3d/glprocess/gl_render_ctx.h:84
pydeepstreamdoc::tensor::TensorDoc::size
constexpr const char * size
Definition: service-maker/sources/python/src/bindings/docstrings/tensordoc.h:46
ds3d::gl::DepthRender
Definition: sources/libs/ds3d/glprocess/gl_render_ctx.h:64
ds3d::gl::WindowInfo::width
uint32_t width
Definition: sources/libs/ds3d/glprocess/gl_render_ctx.h:49
ds3d::gl::PointCloudRender::setLookAt
virtual void setLookAt(const vec3f &positon, const vec3f &target, const vec3f &up)=0
min
int min(int a, int b)
Compute the component-wise minimum.
Definition: sources/libs/nvmultiobjecttracker/include/modules/cuDCFv2/helper_math.h:70
ds3d::gl::iGLRender
Definition: sources/libs/ds3d/glprocess/gl_render_ctx.h:28
ds3d::gl::WindowInfo
Definition: sources/libs/ds3d/glprocess/gl_render_ctx.h:48
ds3d::gl::PointCloudRender::setLidarDataColor
virtual void setLidarDataColor(const vec3b &color)
Definition: sources/libs/ds3d/glprocess/gl_render_ctx.h:82
DS3D_EXPORT_API
#define DS3D_EXPORT_API
Definition: includes/ds3d/common/defines.h:129
ds3d::gl::PointCloudRender::setTexCoordY
virtual void setTexCoordY(bool opposite)=0
ds3d::gl::iGLRender::syncData
virtual ErrCode syncData()=0
ds3d::gl::iGLRender::~iGLRender
virtual ~iGLRender()=default
ds3d::gl::PointCloudRender::setElementSize
virtual void setElementSize(uint32_t elements)=0
ds3d::GuardDataMap
Definition: includes/ds3d/common/hpp/datamap.hpp:27
NvDs3D_CreateVideoDepthRender
DS3D_EXTERN_C_BEGIN DS3D_EXPORT_API ds3d::gl::DepthRender * NvDs3D_CreateVideoDepthRender(bool enableVideo, bool enableDepth)
ds3d::gl::iGLRender::deinitResource
virtual ErrCode deinitResource()=0
NvDs3D_CreateLidarRender
DS3D_EXPORT_API ds3d::gl::PointCloudRender * NvDs3D_CreateLidarRender()
ds3d::gl::DepthRender::setDepthColor
virtual void setDepthColor(const vec3b &minDepthColor, const vec3b &maxDepthColor)=0
ds3d::gl::BaseRender::_window
GuardGlWindow _window
Definition: sources/libs/ds3d/glprocess/gl_render_ctx.h:61
ds3d
Definition: includes/ds3d/common/abi_dataprocess.h:25
ds3d::gl::iGLRender::flush
virtual ErrCode flush()
Definition: sources/libs/ds3d/glprocess/gl_render_ctx.h:45
DS3D_EXTERN_C_END
#define DS3D_EXTERN_C_END
Definition: includes/ds3d/common/defines.h:131
ds3d::gl::PointCloudRender::setPerspective
virtual void setPerspective(float degree, float ratio, float near, float far)=0
ds3d::gl::DepthRender::setDepthRange
virtual void setDepthRange(float min, float max)=0
ds3d::gl::iGLRender::draw
virtual ErrCode draw(GuardDataMap datamap)=0