globjects | C++ library strictly wrapping OpenGL objects | Game Engine library
kandi X-RAY | globjects Summary
kandi X-RAY | globjects Summary
globjects is a cross-platform C++ wrapper for OpenGL API objects. globjects provides object-oriented interfaces to the OpenGL API (3.0 and higher). It reduces the amount of OpenGL code required for rendering and facilitates coherent OpenGL use by means of an additional abstraction layer to glbinding and GLM. Common rendering tasks and processes are automated and missing features of specific OpenGL drivers are partially simulated or even emulated at run-time.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of globjects
globjects Key Features
globjects Examples and Code Snippets
Community Discussions
Trending Discussions on globjects
QUESTION
I have been playing around with OpenGL and shaders and got myself into shadow mapping.
Trying to follow tutorials on the Internet (ogldev and learnopengl), got some unexpected results.
The issue is best described with few screenshots (I have added a static quad with depth framebuffer for debugging):
Somehow I managed to get shadows to be rendered on a ground quad once, with a static light (this commit). But the shadow pattern is, again, incorrect. I strongly suspect model transformation matrix calculaitons on this:
The way I render the scene is quite straightforward:
- create the pipelines:
- for mapping the shadows (filling the depth frame buffer)
- for rendering the scene using the depth frame buffer
- (extra) debugging one, rendering depth frame buffer to a static quad on a screen
- fill the depth frame buffer: using the shadow mapping pipeline, render the scene from the light point, using orthographic projection
- render the shaded scene: using the rendering pipeline and depth frame buffer bind as the first texture, render the scene from a camera point, using perspective projection
Seems like the algorithm in all those tutorials on shadow mapping out there. Yet, instead of a mouray effect (like in all of the tutorials), I get no shadow on the bottom plane whatsoever and weird artifacts (incorrect shadow mapping) on the 3D (chicken) model.
Interestingly enough, if I do not render (for both the shadow mapping and final rendering pass) the chicken model, the plane is lit with the same weird pattern:
I also had to remove any normal transformations from the fragment shader and disable face culling to make the ground plane lit. With front-face culling the plane does not appear in the shadow map (depth buffer).
I assume the following might be causing this issue:
- wrong depth frame buffer setup (data format or texture parameters)
- flipped depth frame buffer texture
- wrong shadow calculations in rendering shaders
- wrong light matrices (view & projection) setup
- wrong matrix calculations in the rendering shaders (given the model transformation matrices for both chicken model and the quad contain both rotation and scaling)
Unfortunately, I ran out of ideas even on how to assess the above assumptions.
Looking for any help on the matter (also feel free to criticize any of my approaches, including C++, CMake, OpenGL and computer graphics).
The full solution source code is available on GitHub, but for convenience I have placed the heavily cut source code below.
shadow-mapping.vert
:
ANSWER
Answered 2021-Jun-26 at 14:36As shameful as it might be, the issue was with the wrong texture being bound.
The globjects library that I use to have few nice(-r) abstractions over OpenGL actually does not provide a smart logic around texture binding (as I blindly assumed). So using just Texture::bind()
and Texture::unbind()
won't automagically keep track of how many textures have been bound and increment an index.
E.g. it does not behave (roughly) like this:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install globjects
The only mandatory run-time dependencies of globjects are the STL of the used compiler, glbinding, and an OpenGL driver library, dynamically linked with your application. However, compiling globjects requires the following required and optional dependencies:. For compilation, a C++11 compliant compiler, e.g., GCC 4.8, Clang 3.3, MSVC 2013 Update 3, is required.
CMake 3.0 or higher for building globjects from source (mandatory for any build from source)
git for version control and script supporting tasks
glbinding as OpenGL API binding
GLM for OpenGL math and data structures (0.9.7 or above)
Eigen3 as alternative to pass vector data to OpenGL (3.3 or above)
GLFW 3.0 or higher for examples
cpplocate for the examples
Qt5 5.0 or higher for the qt-based example
Doxygen 1.8 or higher for generating the documentation on your system graphviz for generating diagrams (optional)
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page