OpenGLEnumMapper Namespace
Definition
Functions Index
| GLenum | toOpenGL (helios::rendering::mesh::PrimitiveType primitiveType) noexcept |
|
Translates a helios abstract PrimitiveType enum to its corresponding OpenGL GLenum value. More... | |
Functions
toOpenGL()
| nodiscard noexcept |
Translates a helios abstract PrimitiveType enum to its corresponding OpenGL GLenum value.
This utility function maps API-agnostic primitive types defined by helios to their OpenGL equivalents. It is used internally by OpenGLMeshRenderer and other OpenGL rendering components.
Supported mappings:
- `PrimitiveType::Points` → `GL_POINTS`
- `PrimitiveType::Lines` → `GL_LINES`
- `PrimitiveType::LineLoop` → `GL_LINE_LOOP`
- `PrimitiveType::LineStrip` → `GL_LINE_STRIP`
- `PrimitiveType::Triangles` → `GL_TRIANGLES`
- `PrimitiveType::TriangleStrip` → `GL_TRIANGLE_STRIP`
- `PrimitiveType::TriangleFan` → `GL_TRIANGLE_FAN`
Example usage: ```cpp auto glPrimitive = OpenGLEnumMapper::toOpenGL(PrimitiveType::Triangles); glDrawElements(glPrimitive, indexCount, GL_UNSIGNED_INT, nullptr); ```
- Parameters
-
primitiveType The API-agnostic PrimitiveType value.
- Returns
The corresponding OpenGL primitive type as a GLenum. Falls back to `GL_TRIANGLES` if the mapping is not explicitly defined.
This function is marked `[[nodiscard]]` to encourage proper usage of the return value.
Definition at line 41 of file OpenGLEnums.ixx.
References helios::rendering::mesh::LineLoop, helios::rendering::mesh::Lines, helios::rendering::mesh::LineStrip, helios::rendering::mesh::Points, helios::rendering::mesh::TriangleFan, helios::rendering::mesh::Triangles and helios::rendering::mesh::TriangleStrip.
Referenced by helios::ext::opengl::rendering::OpenGLMeshRenderer::render.
The documentation for this namespace was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.