OglModel
Generic visual model for OpenGL display. Main class for rendering 3D model in SOFA. This class implements VisuelModelImpl with rendering functions using OpenGL.
`OglModel` is a visual model for OpenGL display, providing controls over transparency, culling, line and point rendering properties, and blending settings within SOFA simulations.
- module
- Sofa.GL.Component.Rendering3D
- namespace
- sofa::gl::component::rendering3d
- include
- sofa/gl/component/rendering3d/OglModel.h
- inherits
-
- VisualModelImpl
- description
The OglModel class in the SOFA framework is designed for rendering 3D models using OpenGL. It does not contribute to any governing equations, constitutive laws, kinematic relations, or numerical methods related to finite element simulations directly. Instead, it serves as a visualization component that handles the graphical representation of geometric and topological data generated by other simulation components.
Mathematical Content
- No Governing Equations: The
OglModelclass does not implement any governing equations such as the weak form or strong form partial differential equations (PDEs) typical in FEM simulations. Its primary function is to visualize these solutions rather than compute them.
Physical Description
- Rendering Visual Model: It provides a visual representation of 3D models, which can be used for inspecting deformations, displacements, and other physical phenomena simulated by the SOFA pipeline. The class handles OpenGL rendering settings such as transparency (
blendTransparency), face culling (cullFace), line width (lineWidth), point size (pointSize), and blending factors (sourceFactor,destFactor).
Numerical Methods or Discretization Choices
- No Discretization: The class does not encode any discretization choices related to FEM. Instead, it relies on the geometric and topological data provided by other components like
MechanicalObjectandTetrahedralSetTopologyContainer, which are responsible for mesh generation and shape function selection.
Role in the Global FEM Pipeline
- Visualization: The role of
OglModelis to visualize the results of the simulation, ensuring that the graphical output corresponds to the physical state described by the numerical solution. Methods such asinternalDraw,loadTextures, andupdateBuffersmanage the rendering process.
Variational / Lagrangian Mechanics Framework Fit
- No Direct Fit: The component does not fit into the variational or Lagrangian mechanics framework directly, as its primary purpose is visualization rather than simulation. However, it plays a crucial role in validating and interpreting the results of FEM simulations by providing a visual feedback loop.
Summary
The OglModel class is primarily an I/O component focused on rendering 3D models for visualization purposes within SOFA's simulation environment. It does not contribute to the mathematical or physical aspects of finite element analysis but instead provides a means to visually inspect and validate the results of such simulations.
Data Fields
| Name | Type | Default | Help |
|---|---|---|---|
blendTransparency |
bool | |
Blend transparent parts |
premultipliedAlpha |
bool | |
is alpha premultiplied ? |
writeZTransparent |
bool | |
Write into Z Buffer for Transparent Object |
alphaBlend |
bool | |
Enable alpha blending |
depthTest |
bool | |
Enable depth testing |
cullFace |
int | |
Face culling (0 = no culling, 1 = cull back faces, 2 = cull front faces) |
lineWidth |
GLfloat | |
Line width (set if != 1, only for lines rendering) |
pointSize |
GLfloat | |
Point size (set if != 1, only for points rendering) |
lineSmooth |
bool | |
Enable smooth line rendering |
pointSmooth |
bool | |
Enable smooth point rendering |
primitiveType |
sofa::helper::OptionsGroup | |
Select types of primitives to send (necessary for some shader types such as geometry or tessellation) |
blendEquation |
sofa::helper::OptionsGroup | |
if alpha blending is enabled this specifies how source and destination colors are combined |
sourceFactor |
sofa::helper::OptionsGroup | |
if alpha blending is enabled this specifies how the red, green, blue, and alpha source blending factors are computed |
destFactor |
sofa::helper::OptionsGroup | |
if alpha blending is enabled this specifies how the red, green, blue, and alpha destination blending factors are computed |
Methods
void
internalDraw
(const core::visual::VisualParams * vparams, bool transparent)
virtual
void
drawGroup
(int ig, bool transparent)
void
drawGroups
(bool transparent)
void
pushTransformMatrix
(float * matrix)
virtual
void
popTransformMatrix
()
virtual
GLenum
getGLenum
(const char * c)
void
parse
(core::objectmodel::BaseObjectDescription * arg)
virtual
bool
loadTexture
(const int & filename)
bool
loadTextures
()
virtual
void
initTextures
()
void
doInitVisual
(const core::visual::VisualParams * vparams)
virtual
void
init
()
virtual
void
updateBuffers
()
virtual
void
deleteBuffers
()
virtual
void
deleteTextures
()
virtual
bool
hasTransparent
()
virtual
bool
hasTexture
()
bool
isUseEdges
()
bool
isUseTriangles
()
bool
isUseQuads
()
sofa::gl::Texture *
getTex
()
GLuint
getVbo
()
GLuint
getIboEdges
()
GLuint
getIboTriangles
()
GLuint
getIboQuads
()
const int &
getTextures
()
void
createVertexBuffer
()
void
createEdgesIndicesBuffer
()
void
createTrianglesIndicesBuffer
()
void
createQuadsIndicesBuffer
()
void
initVertexBuffer
()
void
initEdgesIndicesBuffer
()
void
initTrianglesIndicesBuffer
()
void
initQuadsIndicesBuffer
()
void
updateVertexBuffer
()
void
updateEdgesIndicesBuffer
()
void
updateTrianglesIndicesBuffer
()
void
updateQuadsIndicesBuffer
()
{
"name": "OglModel",
"namespace": "sofa::gl::component::rendering3d",
"module": "Sofa.GL.Component.Rendering3D",
"include": "sofa/gl/component/rendering3d/OglModel.h",
"doc": "Generic visual model for OpenGL display.\n\nMain class for rendering 3D model in SOFA.\n This class implements VisuelModelImpl with rendering functions\n using OpenGL.",
"inherits": [
"VisualModelImpl"
],
"templates": [],
"data_fields": [
{
"name": "blendTransparency",
"type": "bool",
"xmlname": "blendTranslucency",
"help": "Blend transparent parts"
},
{
"name": "premultipliedAlpha",
"type": "bool",
"xmlname": "premultipliedAlpha",
"help": "is alpha premultiplied ?"
},
{
"name": "writeZTransparent",
"type": "bool",
"xmlname": "writeZTransparent",
"help": "Write into Z Buffer for Transparent Object"
},
{
"name": "alphaBlend",
"type": "bool",
"xmlname": "alphaBlend",
"help": "Enable alpha blending"
},
{
"name": "depthTest",
"type": "bool",
"xmlname": "depthTest",
"help": "Enable depth testing"
},
{
"name": "cullFace",
"type": "int",
"xmlname": "cullFace",
"help": "Face culling (0 = no culling, 1 = cull back faces, 2 = cull front faces)"
},
{
"name": "lineWidth",
"type": "GLfloat",
"xmlname": "lineWidth",
"help": "Line width (set if != 1, only for lines rendering)"
},
{
"name": "pointSize",
"type": "GLfloat",
"xmlname": "pointSize",
"help": "Point size (set if != 1, only for points rendering)"
},
{
"name": "lineSmooth",
"type": "bool",
"xmlname": "lineSmooth",
"help": "Enable smooth line rendering"
},
{
"name": "pointSmooth",
"type": "bool",
"xmlname": "pointSmooth",
"help": "Enable smooth point rendering"
},
{
"name": "primitiveType",
"type": "sofa::helper::OptionsGroup",
"xmlname": "primitiveType",
"help": "Select types of primitives to send (necessary for some shader types such as geometry or tessellation)"
},
{
"name": "blendEquation",
"type": "sofa::helper::OptionsGroup",
"xmlname": "blendEquation",
"help": "if alpha blending is enabled this specifies how source and destination colors are combined"
},
{
"name": "sourceFactor",
"type": "sofa::helper::OptionsGroup",
"xmlname": "sfactor",
"help": "if alpha blending is enabled this specifies how the red, green, blue, and alpha source blending factors are computed"
},
{
"name": "destFactor",
"type": "sofa::helper::OptionsGroup",
"xmlname": "dfactor",
"help": "if alpha blending is enabled this specifies how the red, green, blue, and alpha destination blending factors are computed"
}
],
"links": [],
"methods": [
{
"name": "internalDraw",
"return_type": "void",
"params": [
{
"name": "vparams",
"type": "const core::visual::VisualParams *"
},
{
"name": "transparent",
"type": "bool"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
},
{
"name": "drawGroup",
"return_type": "void",
"params": [
{
"name": "ig",
"type": "int"
},
{
"name": "transparent",
"type": "bool"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
},
{
"name": "drawGroups",
"return_type": "void",
"params": [
{
"name": "transparent",
"type": "bool"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
},
{
"name": "pushTransformMatrix",
"return_type": "void",
"params": [
{
"name": "matrix",
"type": "float *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
},
{
"name": "popTransformMatrix",
"return_type": "void",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
},
{
"name": "getGLenum",
"return_type": "GLenum",
"params": [
{
"name": "c",
"type": "const char *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
},
{
"name": "parse",
"return_type": "void",
"params": [
{
"name": "arg",
"type": "core::objectmodel::BaseObjectDescription *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "loadTexture",
"return_type": "bool",
"params": [
{
"name": "filename",
"type": "const int &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "loadTextures",
"return_type": "bool",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "initTextures",
"return_type": "void",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "doInitVisual",
"return_type": "void",
"params": [
{
"name": "vparams",
"type": "const core::visual::VisualParams *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "init",
"return_type": "void",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "updateBuffers",
"return_type": "void",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "deleteBuffers",
"return_type": "void",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "deleteTextures",
"return_type": "void",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "hasTransparent",
"return_type": "bool",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "hasTexture",
"return_type": "bool",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "isUseEdges",
"return_type": "bool",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "isUseTriangles",
"return_type": "bool",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "isUseQuads",
"return_type": "bool",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getTex",
"return_type": "sofa::gl::Texture *",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getVbo",
"return_type": "GLuint",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getIboEdges",
"return_type": "GLuint",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getIboTriangles",
"return_type": "GLuint",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getIboQuads",
"return_type": "GLuint",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getTextures",
"return_type": "const int &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "createVertexBuffer",
"return_type": "void",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "createEdgesIndicesBuffer",
"return_type": "void",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "createTrianglesIndicesBuffer",
"return_type": "void",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "createQuadsIndicesBuffer",
"return_type": "void",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "initVertexBuffer",
"return_type": "void",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "initEdgesIndicesBuffer",
"return_type": "void",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "initTrianglesIndicesBuffer",
"return_type": "void",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "initQuadsIndicesBuffer",
"return_type": "void",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "updateVertexBuffer",
"return_type": "void",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "updateEdgesIndicesBuffer",
"return_type": "void",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "updateTrianglesIndicesBuffer",
"return_type": "void",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "updateQuadsIndicesBuffer",
"return_type": "void",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
}
],
"description": "The `OglModel` class in the SOFA framework is designed for rendering 3D models using OpenGL, providing visual representation capabilities within simulations. It inherits from `VisualModelImpl`, indicating its role in the visualization aspect of SOFA. This component offers numerous data fields and methods to control various aspects of rendering such as transparency handling (`blendTransparency`), face culling (`cullFace`), line and point rendering properties (`lineWidth`, `pointSize`), and blending settings for alpha blending (`alphaBlend`, `sourceFactor`, `destFactor`). The component interacts with other SOFA components through methods like `internalDraw`, which is responsible for drawing visuals, and `loadTextures` to manage texture loading. Methods related to initializing visual data (`doInitVisual`), updating buffers (`updateBuffers`), and managing textures (`initTextures`) ensure the component integrates seamlessly within the broader simulation environment.",
"maths": "The `OglModel` class in the SOFA framework is designed for rendering 3D models using OpenGL. It does not contribute to any governing equations, constitutive laws, kinematic relations, or numerical methods related to finite element simulations directly. Instead, it serves as a visualization component that handles the graphical representation of geometric and topological data generated by other simulation components.\n\n### Mathematical Content\n- **No Governing Equations**: The `OglModel` class does not implement any governing equations such as the weak form or strong form partial differential equations (PDEs) typical in FEM simulations. Its primary function is to visualize these solutions rather than compute them.\n\n### Physical Description\n- **Rendering Visual Model**: It provides a visual representation of 3D models, which can be used for inspecting deformations, displacements, and other physical phenomena simulated by the SOFA pipeline. The class handles OpenGL rendering settings such as transparency (`blendTransparency`), face culling (`cullFace`), line width (`lineWidth`), point size (`pointSize`), and blending factors (`sourceFactor`, `destFactor`).\n\n### Numerical Methods or Discretization Choices\n- **No Discretization**: The class does not encode any discretization choices related to FEM. Instead, it relies on the geometric and topological data provided by other components like `MechanicalObject` and `TetrahedralSetTopologyContainer`, which are responsible for mesh generation and shape function selection.\n\n### Role in the Global FEM Pipeline\n- **Visualization**: The role of `OglModel` is to visualize the results of the simulation, ensuring that the graphical output corresponds to the physical state described by the numerical solution. Methods such as `internalDraw`, `loadTextures`, and `updateBuffers` manage the rendering process.\n\n### Variational / Lagrangian Mechanics Framework Fit\n- **No Direct Fit**: The component does not fit into the variational or Lagrangian mechanics framework directly, as its primary purpose is visualization rather than simulation. However, it plays a crucial role in validating and interpreting the results of FEM simulations by providing a visual feedback loop.\n\n### Summary\nThe `OglModel` class is primarily an I/O component focused on rendering 3D models for visualization purposes within SOFA's simulation environment. It does not contribute to the mathematical or physical aspects of finite element analysis but instead provides a means to visually inspect and validate the results of such simulations.",
"abstract": "`OglModel` is a visual model for OpenGL display, providing controls over transparency, culling, line and point rendering properties, and blending settings within SOFA simulations.",
"sheet": "# OglModel\n\n## Overview\n`OglModel` is a class in the `sofa::gl::component::rendering3d` namespace that implements visualization capabilities for 3D models using OpenGL. It inherits from `VisualModelImpl`, focusing on rendering functions and settings.\n\n## Parameters and Data\nThe significant data fields exposed by `OglModel` control various aspects of rendering:\n- **blendTransparency**: Blend transparent parts (`bool`).\n- **premultipliedAlpha**: Indicates if alpha is premultiplied (`bool`).\n- **writeZTransparent**: Write into Z Buffer for Transparent Object (`bool`).\n- **alphaBlend**: Enable alpha blending (`bool`).\n- **depthTest**: Enable depth testing (`bool`).\n- **cullFace**: Face culling (0 = no culling, 1 = cull back faces, 2 = cull front faces) (`int`).\n- **lineWidth**: Line width (set if != 1, only for lines rendering) (`GLfloat`).\n- **pointSize**: Point size (set if != 1, only for points rendering) (`GLfloat`).\n- **lineSmooth**: Enable smooth line rendering (`bool`).\n- **pointSmooth**: Enable smooth point rendering (`bool`).\n- **primitiveType**: Select types of primitives to send (necessary for some shader types such as geometry or tessellation) (`sofa::helper::OptionsGroup`).\n- **blendEquation**: Specifies how source and destination colors are combined if alpha blending is enabled (`sofa::helper::OptionsGroup`).\n- **sourceFactor**: Specifies how the red, green, blue, and alpha source blending factors are computed if alpha blending is enabled (`sofa::helper::OptionsGroup`).\n- **destFactor**: Specifies how the red, green, blue, and alpha destination blending factors are computed if alpha blending is enabled (`sofa::helper::OptionsGroup`)."
}