![]() |
Image Component Library (ICL)
|
OpenGL Texture Map Image class. More...
#include <GLImg.h>
Public Types | |
| typedef math::FixedColVector< float, 3 > | Vec3 |
| 3D vector type More... | |
| typedef utils::Function< Vec3, int, int > | grid_function |
| a grid function returns a 3D pos from given 2D grid position More... | |
Public Member Functions | |
| GLImg (const core::ImgBase *src=0, core::scalemode sm=core::interpolateNN, int maxCellSize=4096) | |
| creates a new GLImg instance More... | |
| ~GLImg () | |
| destructor More... | |
| void | update (const core::ImgBase *src, int maxCellSize=4096) |
| set new texture data More... | |
| void | setScaleMode (core::scalemode sm) |
| sets the texture interpolation mode More... | |
| bool | isNull () const |
| returns whether a non-null images was buffered More... | |
| void | draw2D (const utils::Rect &r, const utils::Size &windowSize) |
| draws the image to the given 2D rect More... | |
| void | draw2D (const float a[2], const float b[2], const float c[2], const float e[2], const utils::Size &windowSize) |
| draws the image to the given quadrangle More... | |
| void | draw3D (const float a[3], const float b[3], const float c[3], const float d[3], const float na[3]=0, const float nb[3]=0, const float nc[3]=0, const float nd[3]=0, const utils::Point32f &texCoordsA=utils::Point32f(0, 0), const utils::Point32f &texCoordsB=utils::Point32f(1, 0), const utils::Point32f &texCoordsC=utils::Point32f(0, 1), const utils::Point32f &texCoordsD=utils::Point32f(1, 1)) |
| draws the texture to the given nodes quad in 3D space More... | |
| void | draw3DGeneric (int numPoints, const float *xs, const float *ys, const float *zs, int xyzStride, const utils::Point32f *texCoords, const float *nxs=0, const float *nys=0, const float *nzs=0, int nxyzStride=1, bool invertNormals=false) |
| draws the texture using the given 3D Points, texture coordinates and optionally given normals More... | |
| void | draw3D (const float a[3], const float b[3], const float c[3]) |
| draws the texture to given quad that is spanned by two vectors More... | |
| void | drawToGrid (int nx, int ny, const float *xs, const float *ys, const float *zs, const float *nxs=0, const float *nys=0, const float *nzs=0, const int stride=1, bool invertNormals=false) |
| draws the single texture spread to a given grid of nodes More... | |
| void | drawToGrid (int nx, int ny, grid_function gridVertices, grid_function gridNormals=grid_function()) |
| draws the texture to an nx x ny grid whose positions and normals are defined by functions More... | |
| utils::Size | getCells () const |
| returns the number of internal cells used for the texture More... | |
| void | bind (int xCell=0, int yCell=0, int textureUnit=0) const |
| binds the given texture cell using glBindTexture(...) More... | |
| utils::Size | getSize () const |
| returns the image size More... | |
| int | getWidth () const |
| returns current image height More... | |
| int | getHeight () const |
| returns current image width More... | |
| int | getChannels () const |
| returns current image channel count More... | |
| core::depth | getDepth () const |
| returns the image depth More... | |
| core::format | getFormat () const |
| returns the image format More... | |
| utils::Rect | getROI () const |
| returns the image roi More... | |
| utils::Time | getTime () const |
| returns the current images time stamp More... | |
| void | setBCI (int b=-1, int c=-1, int i=-1) |
| sets up current brightness contrast and intensity More... | |
| std::vector< utils::Range64f > | getMinMax () const |
| returns the current minimun and maximum values for all channels More... | |
| std::vector< icl64f > | getColor (int x, int y) const |
| retuns the color at a given image location or a zero sized vector, (x,y) is outside the image More... | |
| const core::ImgBase * | extractImage () const |
| creates core::ImgBase version of the currently buffered images More... | |
| const ImageStatistics & | getStats () const |
| returns statistics of the currently buffered image More... | |
| void | setDrawGrid (bool enabled, float *color=0) |
| sets whether to visualize the pixel-grid or not More... | |
| void | setGridColor (float *color) |
| sets the grid color More... | |
| const float * | getGridColor () const |
| returns the current grid color More... | |
| core::scalemode | getScaleMode () const |
| returns the current scalemode More... | |
| void | lock () const |
| locks the texture buffer More... | |
| void | unlock () const |
| unlocks the texture buffer More... | |
Static Public Member Functions | |
| static int | getMaxTextureSize () |
| returns the maximum texture map size that is supported by the present OpenGL system More... | |
Private Attributes | |
| Data * | m_data |
| internal data structure More... | |
Additional Inherited Members | |
Protected Member Functions inherited from icl::utils::Uncopyable | |
| Uncopyable () | |
| Empty base constructor. More... | |
OpenGL Texture Map Image class.
The GLImg provides a simple interface to use ICL images as OpenGL texture maps.
| typedef utils::Function<Vec3,int,int> icl::qt::GLImg::grid_function |
a grid function returns a 3D pos from given 2D grid position
| typedef math::FixedColVector<float,3> icl::qt::GLImg::Vec3 |
3D vector type
| icl::qt::GLImg::GLImg | ( | const core::ImgBase * | src = 0, |
| core::scalemode | sm = core::interpolateNN, |
||
| int | maxCellSize = 4096 |
||
| ) |
| icl::qt::GLImg::~GLImg | ( | ) |
destructor
| void icl::qt::GLImg::bind | ( | int | xCell = 0, |
| int | yCell = 0, |
||
| int | textureUnit = 0 |
||
| ) | const |
binds the given texture cell using glBindTexture(...)
| void icl::qt::GLImg::draw2D | ( | const utils::Rect & | r, |
| const utils::Size & | windowSize | ||
| ) |
draws the image to the given 2D rect
This method is optimized for the OpenGL parameters set by the ICLQt::Widget class
| void icl::qt::GLImg::draw2D | ( | const float | a[2], |
| const float | b[2], | ||
| const float | c[2], | ||
| const float | e[2], | ||
| const utils::Size & | windowSize | ||
| ) |
draws the image to the given quadrangle
This method is optimized for the OpenGL parameters set by the ICLQt::Widget class
| void icl::qt::GLImg::draw3D | ( | const float | a[3], |
| const float | b[3], | ||
| const float | c[3], | ||
| const float | d[3], | ||
| const float | na[3] = 0, |
||
| const float | nb[3] = 0, |
||
| const float | nc[3] = 0, |
||
| const float | nd[3] = 0, |
||
| const utils::Point32f & | texCoordsA = utils::Point32f(0, 0), |
||
| const utils::Point32f & | texCoordsB = utils::Point32f(1, 0), |
||
| const utils::Point32f & | texCoordsC = utils::Point32f(0, 1), |
||
| const utils::Point32f & | texCoordsD = utils::Point32f(1, 1) |
||
| ) |
draws the texture to the given nodes quad in 3D space
the point order is
a ---- b | | | | c ---- d
An addition to the corner 3D positions (a, b, c, and d), optionally normals (na, nb, nc and nd) can be given. The normals are only used, if none of the normal pointers is null. Additionally non-standard texture coordinates can be used to draw only parts of the texture.
|
inline |
draws the texture to given quad that is spanned by two vectors
| void icl::qt::GLImg::draw3DGeneric | ( | int | numPoints, |
| const float * | xs, | ||
| const float * | ys, | ||
| const float * | zs, | ||
| int | xyzStride, | ||
| const utils::Point32f * | texCoords, | ||
| const float * | nxs = 0, |
||
| const float * | nys = 0, |
||
| const float * | nzs = 0, |
||
| int | nxyzStride = 1, |
||
| bool | invertNormals = false |
||
| ) |
draws the texture using the given 3D Points, texture coordinates and optionally given normals
The strides are given in float-units. If normals are not given (i.e. at least one of the points nxs, nys or nzs is null, no normals will be set.
| void icl::qt::GLImg::drawToGrid | ( | int | nx, |
| int | ny, | ||
| const float * | xs, | ||
| const float * | ys, | ||
| const float * | zs, | ||
| const float * | nxs = 0, |
||
| const float * | nys = 0, |
||
| const float * | nzs = 0, |
||
| const int | stride = 1, |
||
| bool | invertNormals = false |
||
| ) |
draws the single texture spread to a given grid of nodes
| void icl::qt::GLImg::drawToGrid | ( | int | nx, |
| int | ny, | ||
| grid_function | gridVertices, | ||
| grid_function | gridNormals = grid_function() |
||
| ) |
draws the texture to an nx x ny grid whose positions and normals are defined by functions
The grid results are buffered internally in order to avoid extra function evaluations. Once, the data is buffered, it is passed to GLImg::drawGrid(int,int,const float*,const float*,const float*,const float*,const float*,const float*,int)
| const core::ImgBase* icl::qt::GLImg::extractImage | ( | ) | const |
creates core::ImgBase version of the currently buffered images
Please note that the ownership is not passed to the caller!
| utils::Size icl::qt::GLImg::getCells | ( | ) | const |
returns the number of internal cells used for the texture
| int icl::qt::GLImg::getChannels | ( | ) | const |
returns current image channel count
| std::vector<icl64f> icl::qt::GLImg::getColor | ( | int | x, |
| int | y | ||
| ) | const |
retuns the color at a given image location or a zero sized vector, (x,y) is outside the image
| core::depth icl::qt::GLImg::getDepth | ( | ) | const |
returns the image depth
| core::format icl::qt::GLImg::getFormat | ( | ) | const |
returns the image format
| const float* icl::qt::GLImg::getGridColor | ( | ) | const |
returns the current grid color
| int icl::qt::GLImg::getHeight | ( | ) | const |
returns current image width
|
static |
returns the maximum texture map size that is supported by the present OpenGL system
| std::vector<utils::Range64f> icl::qt::GLImg::getMinMax | ( | ) | const |
returns the current minimun and maximum values for all channels
| utils::Rect icl::qt::GLImg::getROI | ( | ) | const |
returns the image roi
| core::scalemode icl::qt::GLImg::getScaleMode | ( | ) | const |
returns the current scalemode
|
inline |
returns the image size
| const ImageStatistics& icl::qt::GLImg::getStats | ( | ) | const |
returns statistics of the currently buffered image
| utils::Time icl::qt::GLImg::getTime | ( | ) | const |
returns the current images time stamp
| int icl::qt::GLImg::getWidth | ( | ) | const |
returns current image height
| bool icl::qt::GLImg::isNull | ( | ) | const |
returns whether a non-null images was buffered
| void icl::qt::GLImg::lock | ( | ) | const |
locks the texture buffer
| void icl::qt::GLImg::setBCI | ( | int | b = -1, |
| int | c = -1, |
||
| int | i = -1 |
||
| ) |
sets up current brightness contrast and intensity
if b=c=i=-1 then, brightness is adapted automatically
| void icl::qt::GLImg::setDrawGrid | ( | bool | enabled, |
| float * | color = 0 |
||
| ) |
sets whether to visualize the pixel-grid or not
| void icl::qt::GLImg::setGridColor | ( | float * | color | ) |
sets the grid color
| void icl::qt::GLImg::setScaleMode | ( | core::scalemode | sm | ) |
sets the texture interpolation mode
| void icl::qt::GLImg::unlock | ( | ) | const |
unlocks the texture buffer
| void icl::qt::GLImg::update | ( | const core::ImgBase * | src, |
| int | maxCellSize = 4096 |
||
| ) |
set new texture data
if source is null, the texture handle is deleted and isNull() will return true
|
private |
internal data structure
internal data pointer
1.8.15