![]() |
anatomist
5.1.2
3D neuroimaging data viewer
|
Base class for all OpenGL objects in Anatomist (with OpenGL display lists) More...
#include <anatomist/surface/glcomponent.h>
Classes | |
struct | TexExtrema |
struct | TexInfo |
Semi-private structure. More... | |
Public Types | |
enum | glTextureMode { glGEOMETRIC , glLINEAR , glREPLACE , glDECAL , glBLEND , glADD , glCOMBINE , glLINEAR_A_IF_A , glLINEAR_ON_DEFINED , glLINEAR_A_IF_B = glLINEAR_ON_DEFINED , glLINEAR_A_IF_NOT_A , glLINEAR_A_IF_NOT_B , glLINEAR_B_IF_A , glLINEAR_B_IF_B , glLINEAR_B_IF_NOT_A , glLINEAR_B_IF_NOT_B , glLINEAR_A_IF_A_ALPHA , glLINEAR_A_IF_NOT_B_ALPHA , glLINEAR_B_IF_B_ALPHA , glLINEAR_B_IF_NOT_A_ALPHA , glMAX_CHANNEL , glMIN_CHANNEL , glMAX_ALPHA , glMIN_ALPHA , glGEOMETRIC_SQRT , glGEOMETRIC_LIGHTEN } |
enum | glTextureFiltering { glFILT_NEAREST , glFILT_LINEAR } |
enum | glPart { glGENERAL , glBODY , glMATERIAL , glGEOMETRY , glPALETTE , glREFERENTIAL , glTEXIMAGE , glTEXENV , glNOPART , glTEXIMAGE_NUM , glTEXENV_NUM } |
GL object parts, each driving a GL list. More... | |
enum | glAutoTexturingMode { glTEX_MANUAL , glTEX_OBJECT_LINEAR , glTEX_EYE_LINEAR , glTEX_SPHERE_MAP , glTEX_REFLECTION_MAP , glTEX_NORMAL_MAP } |
typedef ViewState::glSelectRenderMode | glSelectRenderMode |
Public Member Functions | |
GLComponent () | |
virtual | ~GLComponent () |
void | clearLists () |
virtual const GLComponent * | glAPI () const |
virtual GLComponent * | glAPI () |
virtual const Sliceable * | sliceableAPI () const |
virtual Sliceable * | sliceableAPI () |
virtual void | glClearHasChangedFlags () const |
virtual void | glSetChanged (glPart, bool=true) const |
virtual bool | glHasChanged (glPart) const |
void | setShader (const Shader &shader) |
void | removeShader () |
void | setupShader () |
create, setup, or remove the shader More... | |
const Shader * | getShader () const |
Shader * | getShader () |
virtual void | setShaderParameters (const Shader &shader, const ViewState &state) const |
virtual const Material * | glMaterial () const |
virtual const AObjectPalette * | glPalette (unsigned tex=0) const |
virtual unsigned | glNumVertex (const ViewState &) const |
virtual const GLfloat * | glVertexArray (const ViewState &) const |
virtual const GLfloat * | glNormalArray (const ViewState &) const |
normals array (optional), default=0 (no normals, flat shaded faces) More... | |
virtual unsigned | glPolygonSize (const ViewState &) const |
number of vertices per polygon (default = 3: triangles) More... | |
virtual unsigned | glNumPolygon (const ViewState &) const |
virtual const GLuint * | glPolygonArray (const ViewState &) const |
virtual unsigned long | glMaxNumDisplayedPolygons () const |
Limit to the number of displayed polygons (default: 0, unlimited or ) global default value) More... | |
virtual void | glSetMaxNumDisplayedPolygons (unsigned long n) |
virtual void | glSetTexImageChanged (bool x=true, unsigned tex=0) const |
virtual void | glSetTexEnvChanged (bool x=true, unsigned tex=0) const |
virtual unsigned | glNumTextures () const |
virtual unsigned | glNumTextures (const ViewState &) const |
virtual glTextureMode | glTexMode (unsigned tex=0) const |
virtual void | glSetTexMode (glTextureMode mode, unsigned tex=0) |
virtual float | glTexRate (unsigned tex=0) const |
virtual void | glSetTexRate (float rate, unsigned tex=0) |
virtual glTextureFiltering | glTexFiltering (unsigned tex=0) const |
virtual void | glSetTexFiltering (glTextureFiltering x, unsigned tex=0) |
virtual glAutoTexturingMode | glAutoTexMode (unsigned tex=0) const |
virtual void | glSetAutoTexMode (glAutoTexturingMode mode, unsigned tex=0) |
virtual const float * | glAutoTexParams (unsigned coord=0, unsigned tex=0) const |
virtual void | glSetAutoTexParams (const float *params, unsigned coord=0, unsigned tex=0) |
virtual bool | glTexImageChanged (unsigned tex=0) const |
virtual bool | glTexEnvChanged (unsigned tex=0) const |
virtual GLint | glGLTexMode (unsigned tex=0) const |
virtual GLint | glGLTexFiltering (unsigned tex=0) const |
virtual void | glSetTexRGBInterpolation (bool x, unsigned tex=0) |
virtual bool | glTexRGBInterpolation (unsigned tex=0) const |
virtual unsigned | glDimTex (const ViewState &, unsigned tex=0) const |
texture dimension (1, 2 [or 3]) More... | |
virtual unsigned | glTexCoordSize (const ViewState &, unsigned tex=0) const |
texture array size (must be >= numVertex to work), defalut=0 More... | |
virtual const GLfloat * | glTexCoordArray (const ViewState &, unsigned tex=0) const |
virtual const TexExtrema & | glTexExtrema (unsigned tex=0) const |
virtual TexExtrema & | glTexExtrema (unsigned tex=0) |
virtual GLPrimitives | glMainGLL (const ViewState &) |
virtual void | glGarbageCollector (int nkept=-1) |
Frees unused display lists. More... | |
unsigned | glStateMemory () const |
Number of unused display lists in different states kept in memory (default: 4) More... | |
virtual void | glSetStateMemory (unsigned n) |
virtual bool | glMakeBodyGLL (const ViewState &state, const GLList &gllist) const |
If you want to make a non-standard GL display list for the body geometry, overload this function to fill gllist . More... | |
virtual void | glBeforeBodyGLL (const ViewState &state, GLPrimitives &pl) const |
GL list to execute before the body is rendered. More... | |
virtual void | glAfterBodyGLL (const ViewState &state, GLPrimitives &pl) const |
GL list to execute after the body is rendered. More... | |
virtual carto::VolumeRef< AimsRGBA > | glBuildTexImage (const ViewState &state, unsigned tex, int dimx=-1, int dimy=-1, bool useTexScale=true) const |
If you make non-standard textures (ie not from a palette), overload this function. More... | |
virtual bool | glMakeTexImage (const ViewState &state, const GLTexture &gltex, unsigned tex) const |
If you make non-standard textures (ie not from a palette), overload this function to fill gltex . More... | |
virtual bool | glMakeTexEnvGLL (const ViewState &state, const GLList &gllist, unsigned tex) const |
virtual GLPrimitives | glBodyGLL (const ViewState &state) const |
virtual GLPrimitives | glMaterialGLL (const ViewState &state) const |
virtual GLPrimitives | glTexNameGLL (const ViewState &, unsigned tex=0) const |
virtual GLPrimitives | glTexEnvGLL (const ViewState &, unsigned tex=0) const |
virtual void | glSetMainGLL (const std::string &state, GLPrimitives x) |
virtual void | glSetBodyGLL (const std::string &state, RefGLItem x) |
virtual void | glSetMaterialGLL (const std::string &state, RefGLItem x) |
virtual void | glSetTexNameGLL (const std::string &state, RefGLItem x, unsigned tex=0) |
virtual std::set< glTextureMode > | glAllowedTexModes (unsigned tex=0) const |
List of actually allowed texturing modes for this particular object. More... | |
virtual std::set< glTextureFiltering > | glAllowedTexFilterings (unsigned tex=0) const |
virtual std::set< glAutoTexturingMode > | glAllowedAutoTexModes (unsigned tex=0) const |
virtual bool | glAllowedTexRGBInterpolation (unsigned tex=0) const |
virtual bool | glAllowedTexRate (unsigned tex=0) const |
virtual std::string | viewStateID (glPart part, const ViewState &) const |
Makes a unique ID from a viewstate. More... | |
virtual carto::Object | debugInfo () const |
int | glObjectID () const |
virtual TexInfo & | glTexInfo (unsigned tex=0) const |
Static Public Member Functions | |
static unsigned long | glGlobalMaxNumDisplayedPolygons () |
static void | glSetGlobalMaxNumDisplayedPolygons (unsigned long n) |
static GLPrimitives | glHandleTransformation (const ViewState &vs, const Referential *myref) |
helper function used in AObject::render() More... | |
static GLPrimitives | glPopTransformation (const ViewState &vs, const Referential *myref) |
called after glHandleTransformation() and glMainGLL() to pop the transformation matrix More... | |
Protected Member Functions | |
void | glAddTextures (unsigned ntex=1) |
Base class for all OpenGL objects in Anatomist (with OpenGL display lists)
This object represents the virtual API which allows Anatomist to use objects geometric properties, and to render in 3D OpenGL views.
For a general explanation on how it is organized and works, see the Anatomist Objects and OpenGL rendering page.
Definition at line 66 of file glcomponent.h.
Definition at line 167 of file glcomponent.h.
Enumerator | |
---|---|
glTEX_MANUAL | |
glTEX_OBJECT_LINEAR | |
glTEX_EYE_LINEAR | |
glTEX_SPHERE_MAP | |
glTEX_REFLECTION_MAP | |
glTEX_NORMAL_MAP |
Definition at line 157 of file glcomponent.h.
GL object parts, each driving a GL list.
Each may be updated / rebuilt at different times.
GL lists of parts are rebuilt when the object has changed for the selected part, or when a different view on the same objet is asked. Anatomist holds internal caches for such lists, which are identified using the viewStateID() method.
Enumerator | |
---|---|
glGENERAL | General list, this one calls the others, so should be rebuilt when any other part changes. This is ensured by the internal mechanisms of GLComponent (in glMainGLL() method). |
glBODY | Body part: gathers vertices, polygons, normals, textures alltogether. |
glMATERIAL | Material / coloring list. Also handles rendering properties. |
glGEOMETRY | Geometry is the polygons, normals arrays. The geometry is not really handled by the GLComponent now, it is rather reserved for future use. The glBODY part is the one used currently. However, changing glGEOMETRY involves also changing glBODY. |
glPALETTE | Palette settings. The colormap itself (when used) is generally in a texture image. |
glREFERENTIAL | Coordinates transformations list. |
glTEXIMAGE | Texture image part. This is stored in a GL texture object, which is used by the glTEXENV part, so rebuilding a glTEXIMAGE (either because of a change or a different view) generally also requires rebuilding the glTEXENV part, but this implication is not hard-coded. |
glTEXENV | Texture environment part: activate texture units, bind textures, setup their properties. |
glNOPART | |
glTEXIMAGE_NUM | glTEXIMAGE_NUM + 2* texnum flags texture #texnum, reserved for Observable pattern |
glTEXENV_NUM | glTEXENV_NUM + 2* texnum flags texture #texnum, reserved for Observable pattern |
Definition at line 113 of file glcomponent.h.
Enumerator | |
---|---|
glFILT_NEAREST | |
glFILT_LINEAR |
Definition at line 99 of file glcomponent.h.
Definition at line 69 of file glcomponent.h.
anatomist::GLComponent::GLComponent | ( | ) |
|
virtual |
void anatomist::GLComponent::clearLists | ( | ) |
|
virtual |
|
inline |
Definition at line 397 of file glcomponent.h.
|
inline |
Definition at line 396 of file glcomponent.h.
|
protected |
|
virtual |
GL list to execute after the body is rendered.
Reimplemented in anatomist::VectorField, and anatomist::Fusion2DMesh.
|
virtual |
|
virtual |
|
virtual |
List of actually allowed texturing modes for this particular object.
Reimplemented in anatomist::Fusion2D.
|
virtual |
|
virtual |
Reimplemented in anatomist::Sliceable.
|
inlinevirtual |
Reimplemented in anatomist::VectorField, anatomist::TransformedObject, anatomist::AMTexture, anatomist::AGLObject, anatomist::Fusion2DMesh, anatomist::VolRenderShader, anatomist::VolRender, anatomist::SliceableObject, anatomist::GLMObject, anatomist::Fusion2D, and anatomist::AGraph.
Definition at line 192 of file glcomponent.h.
|
inlinevirtual |
Reimplemented in anatomist::VectorField, anatomist::TransformedObject, anatomist::AMTexture, anatomist::AGLObject, anatomist::Fusion2DMesh, anatomist::VolRenderShader, anatomist::VolRender, anatomist::SliceableObject, anatomist::GLMObject, anatomist::Fusion2D, and anatomist::AGraph.
Definition at line 191 of file glcomponent.h.
|
virtual |
Reimplemented in anatomist::PlanarFusion3D, anatomist::AMTexture, anatomist::GLMObject, and anatomist::Fusion3D.
|
virtual |
Reimplemented in anatomist::PlanarFusion3D, anatomist::AMTexture, anatomist::GLMObject, and anatomist::Fusion3D.
|
virtual |
GL list to execute before the body is rendered.
Reimplemented in anatomist::VectorField, and anatomist::Fusion2DMesh.
|
virtual |
|
virtual |
If you make non-standard textures (ie not from a palette), overload this function.
New in Anatomist 4.5, it is used by glMakeTexImage, and may also be used to save the texture data of an arbitrary object.
dimx | and dimy are target texture sizes. If left to -1 (default), the size is calculated internally. |
useTexScale | if true (default), allow using OpenGL scaling in texture space. Otherwise the palette image will be adapted to fit the scale. |
Reimplemented in anatomist::PlanarFusion3D, and anatomist::Sliceable.
|
virtual |
Reimplemented in anatomist::PlanarFusion3D, anatomist::GLMObject, anatomist::Fusion3D, and anatomist::Fusion2D.
|
inlinevirtual |
texture dimension (1, 2 [or 3])
Reimplemented in anatomist::PlanarFusion3D, anatomist::Fusion3D, anatomist::ATexture, anatomist::TextObject, anatomist::AMTexture, anatomist::VolRenderShader, anatomist::VolRender, anatomist::Sliceable, and anatomist::GLMObject.
Definition at line 414 of file glcomponent.h.
|
virtual |
Frees unused display lists.
Display lists are created when requested by views, according to a view state, and are stored in the object. As several view states will probably be needed by different views, they are all kept internally (by a reference counter). When a display list is no longer used by views, it is still not destroyed because it could be costy to re-crete it for another view later.
To avoid objects to grow and eat all memory, this function will be called from time to time (when creating new lists) to free some lists which are not currently used by any view.
nkept | if negative, glStateMemory() unused items are kept in the object, otherwise the specified number are kept |
Reimplemented in anatomist::AMTexture, anatomist::GLMObject, and anatomist::Fusion3D.
|
static |
|
virtual |
|
virtual |
|
static |
helper function used in AObject::render()
|
virtual |
|
virtual |
|
virtual |
If you want to make a non-standard GL display list for the body geometry, overload this function to fill gllist
.
Reimplemented in anatomist::VolRenderShader, anatomist::VolRender, anatomist::ASurface< D >, anatomist::ASurface< 2 >, and anatomist::ASurface< 3 >.
Referenced by anatomist::ASurface< 2 >::surfaceOfTime().
|
virtual |
Reimplemented in anatomist::GLMObject.
|
virtual |
If you make non-standard textures (ie not from a palette), overload this function to fill gltex
.
Since Anatomist 4.5, glMakeTexImage calls glBuildTexImage, which is actually the method to be overloaded by subclasses.
Reimplemented in anatomist::TextObject, anatomist::PlanarFusion3D, anatomist::VolRenderShader, anatomist::VolRender, anatomist::Sliceable, and anatomist::GLMObject.
|
inlinevirtual |
Reimplemented in anatomist::TesselatedMesh, anatomist::AGLObject, anatomist::Fusion2DMesh, anatomist::VolRenderShader, anatomist::VolRender, anatomist::SliceableObject, anatomist::GLMObject, and anatomist::Fusion2D.
Definition at line 395 of file glcomponent.h.
|
virtual |
Reimplemented in anatomist::GLMObject.
|
virtual |
Limit to the number of displayed polygons (default: 0, unlimited or ) global default value)
|
inlinevirtual |
normals array (optional), default=0 (no normals, flat shaded faces)
Reimplemented in anatomist::Sliceable, anatomist::TesselatedMesh, anatomist::ASurface< D >, anatomist::ASurface< 2 >, anatomist::ASurface< 3 >, anatomist::Fusion2DMesh, anatomist::GLMObject, and anatomist::Bucket.
Definition at line 405 of file glcomponent.h.
|
inlinevirtual |
Reimplemented in anatomist::TesselatedMesh, anatomist::ASurface< D >, anatomist::ASurface< 2 >, anatomist::ASurface< 3 >, anatomist::Fusion2DMesh, anatomist::Sliceable, anatomist::GLMObject, and anatomist::Bucket.
Definition at line 409 of file glcomponent.h.
|
virtual |
Reimplemented in anatomist::ATexture, anatomist::PlanarFusion3D, anatomist::AMTexture, anatomist::GLMObject, and anatomist::Fusion3D.
|
virtual |
Reimplemented in anatomist::ATexture, anatomist::PlanarFusion3D, anatomist::AMTexture, anatomist::GLMObject, anatomist::Fusion3D, and anatomist::Fusion2D.
|
inlinevirtual |
Reimplemented in anatomist::TesselatedMesh, anatomist::ASurface< D >, anatomist::ASurface< 2 >, anatomist::ASurface< 3 >, anatomist::Fusion2DMesh, anatomist::Sliceable, anatomist::GLMObject, and anatomist::Bucket.
Definition at line 401 of file glcomponent.h.
int anatomist::GLComponent::glObjectID | ( | ) | const |
|
inlinevirtual |
Reimplemented in anatomist::PlanarFusion3D, anatomist::VectorField, anatomist::AMTexture, anatomist::AGLObject, anatomist::VolRenderShader, anatomist::VolRender, anatomist::SliceableObject, anatomist::GLMObject, anatomist::Fusion3D, anatomist::Fusion2D, anatomist::AInterpoler, and anatomist::AGraph.
Definition at line 399 of file glcomponent.h.
|
inlinevirtual |
Reimplemented in anatomist::TesselatedMesh, anatomist::ASurface< D >, anatomist::ASurface< 2 >, anatomist::ASurface< 3 >, anatomist::Fusion2DMesh, anatomist::Sliceable, anatomist::GLMObject, and anatomist::Bucket.
Definition at line 411 of file glcomponent.h.
|
inlinevirtual |
number of vertices per polygon (default = 3: triangles)
Reimplemented in anatomist::TesselatedMesh, anatomist::ASurface< D >, anatomist::ASurface< 2 >, anatomist::ASurface< 3 >, anatomist::Fusion2DMesh, anatomist::Sliceable, anatomist::GLMObject, and anatomist::Bucket.
Definition at line 407 of file glcomponent.h.
|
static |
called after glHandleTransformation() and glMainGLL() to pop the transformation matrix
|
virtual |
Reimplemented in anatomist::AMTexture, anatomist::GLMObject, and anatomist::Fusion3D.
|
virtual |
Reimplemented in anatomist::PlanarFusion3D, anatomist::AMTexture, anatomist::GLMObject, and anatomist::Fusion3D.
|
virtual |
|
virtual |
Reimplemented in anatomist::TextObject, anatomist::AGLObject, anatomist::VolRenderShader, anatomist::VolRender, anatomist::SliceableObject, anatomist::Fusion2D, and anatomist::GLMObject.
Referenced by removeShader(), and setShader().
|
static |
|
virtual |
|
virtual |
Reimplemented in anatomist::GLMObject.
|
virtual |
|
virtual |
|
virtual |
|
virtual |
Reimplemented in anatomist::AMTexture, anatomist::GLMObject, and anatomist::Fusion3D.
|
virtual |
|
virtual |
Reimplemented in anatomist::AMTexture, anatomist::GLMObject, anatomist::Fusion3D, and anatomist::Fusion2D.
|
virtual |
Reimplemented in anatomist::GLMObject.
|
virtual |
Reimplemented in anatomist::AMTexture, anatomist::GLMObject, and anatomist::Fusion3D.
|
virtual |
Reimplemented in anatomist::AMTexture, and anatomist::GLMObject.
unsigned anatomist::GLComponent::glStateMemory | ( | ) | const |
Number of unused display lists in different states kept in memory (default: 4)
|
inlinevirtual |
Reimplemented in anatomist::PlanarFusion3D, anatomist::AInterpoler, anatomist::Fusion3D, anatomist::ATexture, anatomist::TextObject, anatomist::AMTexture, anatomist::Sliceable, and anatomist::GLMObject.
Definition at line 419 of file glcomponent.h.
|
inlinevirtual |
texture array size (must be >= numVertex to work), defalut=0
Reimplemented in anatomist::PlanarFusion3D, anatomist::Fusion3D, anatomist::ATexture, anatomist::TextObject, anatomist::AMTexture, anatomist::Sliceable, anatomist::GLMObject, and anatomist::AInterpoler.
Definition at line 416 of file glcomponent.h.
|
virtual |
Reimplemented in anatomist::GLMObject.
|
virtual |
Reimplemented in anatomist::GLMObject, and anatomist::Fusion3D.
|
virtual |
Reimplemented in anatomist::VolRenderShader, anatomist::VolRender, anatomist::GLMObject, anatomist::Fusion3D, and anatomist::AInterpoler.
|
virtual |
Reimplemented in anatomist::VolRenderShader, anatomist::VolRender, anatomist::GLMObject, anatomist::Fusion3D, and anatomist::AInterpoler.
|
virtual |
Reimplemented in anatomist::PlanarFusion3D, anatomist::AMTexture, anatomist::GLMObject, and anatomist::Fusion3D.
|
virtual |
Reimplemented in anatomist::GLMObject.
|
virtual |
Reimplemented in anatomist::AMTexture, and anatomist::GLMObject.
|
virtual |
Reimplemented in anatomist::PlanarFusion3D, anatomist::AMTexture, anatomist::GLMObject, and anatomist::Fusion3D.
|
virtual |
Reimplemented in anatomist::AMTexture, anatomist::GLMObject, and anatomist::Fusion3D.
|
virtual |
Reimplemented in anatomist::PlanarFusion3D, anatomist::AMTexture, anatomist::GLMObject, and anatomist::Fusion3D.
|
virtual |
Reimplemented in anatomist::AMTexture, and anatomist::GLMObject.
|
inlinevirtual |
Reimplemented in anatomist::TesselatedMesh, anatomist::ASurface< D >, anatomist::ASurface< 2 >, anatomist::ASurface< 3 >, anatomist::Fusion2DMesh, anatomist::Sliceable, anatomist::GLMObject, and anatomist::Bucket.
Definition at line 403 of file glcomponent.h.
|
inline |
Definition at line 386 of file glcomponent.h.
References glBODY, and glSetChanged().
|
inline |
Definition at line 380 of file glcomponent.h.
References glBODY, and glSetChanged().
|
inlinevirtual |
Reimplemented in anatomist::AVolumeBase, anatomist::ATexSurface, and anatomist::GLMObject.
Definition at line 398 of file glcomponent.h.
References anatomist::Shader::setShaderParameters().
void anatomist::GLComponent::setupShader | ( | ) |
create, setup, or remove the shader
|
inlinevirtual |
Reimplemented in anatomist::VectorField, anatomist::Fusion2DMesh, anatomist::SliceableObject, anatomist::Sliceable, and anatomist::Fusion2D.
Definition at line 194 of file glcomponent.h.
|
inlinevirtual |
Reimplemented in anatomist::VectorField, anatomist::Fusion2DMesh, anatomist::SliceableObject, anatomist::Sliceable, and anatomist::Fusion2D.
Definition at line 193 of file glcomponent.h.
|
virtual |
Makes a unique ID from a viewstate.
The ID must be unique within the GLComponent instance and for the part part
. Depending on the aspects of the viewstate to take into account, subclasses may have to overload it.
For instance, a mesh may build an ID only taking time into account, whereas a volume slice must also code the slice position and orientation into the ID.
Reimplemented in anatomist::PlanarFusion3D, anatomist::AMTexture, anatomist::AGLObject, anatomist::VolRenderShader, anatomist::VolRender, anatomist::Sliceable, anatomist::GLMObject, anatomist::Fusion3D, anatomist::AInterpoler, and anatomist::Bucket.