Image Component Library (ICL)
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
icl::qt::GLImg Class Reference

OpenGL Texture Map Image class. More...

#include <GLImg.h>

Inheritance diagram for icl::qt::GLImg:
icl::utils::Uncopyable

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< icl64fgetColor (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::ImgBaseextractImage () const
 creates core::ImgBase version of the currently buffered images More...
 
const ImageStatisticsgetStats () 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...
 

Detailed Description

OpenGL Texture Map Image class.

The GLImg provides a simple interface to use ICL images as OpenGL texture maps.

Member Typedef Documentation

◆ grid_function

a grid function returns a 3D pos from given 2D grid position

◆ Vec3

3D vector type

Constructor & Destructor Documentation

◆ GLImg()

icl::qt::GLImg::GLImg ( const core::ImgBase src = 0,
core::scalemode  sm = core::interpolateNN,
int  maxCellSize = 4096 
)

creates a new GLImg instance

optional parameters are

Parameters
srcoptionally given source image (if null, isNull() will return true)
smtexture interpolation mode (either interpolateNN or interpolateLIN)
maxCellSizethe cells size (see BUF)

◆ ~GLImg()

icl::qt::GLImg::~GLImg ( )

destructor

Member Function Documentation

◆ bind()

void icl::qt::GLImg::bind ( int  xCell = 0,
int  yCell = 0,
int  textureUnit = 0 
) const

binds the given texture cell using glBindTexture(...)

◆ draw2D() [1/2]

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

◆ draw2D() [2/2]

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

◆ draw3D() [1/2]

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.

◆ draw3D() [2/2]

void icl::qt::GLImg::draw3D ( const float  a[3],
const float  b[3],
const float  c[3] 
)
inline

draws the texture to given quad that is spanned by two vectors

◆ draw3DGeneric()

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.

◆ drawToGrid() [1/2]

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

◆ drawToGrid() [2/2]

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)

◆ extractImage()

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!

◆ getCells()

utils::Size icl::qt::GLImg::getCells ( ) const

returns the number of internal cells used for the texture

◆ getChannels()

int icl::qt::GLImg::getChannels ( ) const

returns current image channel count

◆ getColor()

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

◆ getDepth()

core::depth icl::qt::GLImg::getDepth ( ) const

returns the image depth

◆ getFormat()

core::format icl::qt::GLImg::getFormat ( ) const

returns the image format

◆ getGridColor()

const float* icl::qt::GLImg::getGridColor ( ) const

returns the current grid color

◆ getHeight()

int icl::qt::GLImg::getHeight ( ) const

returns current image width

◆ getMaxTextureSize()

static int icl::qt::GLImg::getMaxTextureSize ( )
static

returns the maximum texture map size that is supported by the present OpenGL system

◆ getMinMax()

std::vector<utils::Range64f> icl::qt::GLImg::getMinMax ( ) const

returns the current minimun and maximum values for all channels

◆ getROI()

utils::Rect icl::qt::GLImg::getROI ( ) const

returns the image roi

◆ getScaleMode()

core::scalemode icl::qt::GLImg::getScaleMode ( ) const

returns the current scalemode

◆ getSize()

utils::Size icl::qt::GLImg::getSize ( ) const
inline

returns the image size

◆ getStats()

const ImageStatistics& icl::qt::GLImg::getStats ( ) const

returns statistics of the currently buffered image

◆ getTime()

utils::Time icl::qt::GLImg::getTime ( ) const

returns the current images time stamp

◆ getWidth()

int icl::qt::GLImg::getWidth ( ) const

returns current image height

◆ isNull()

bool icl::qt::GLImg::isNull ( ) const

returns whether a non-null images was buffered

◆ lock()

void icl::qt::GLImg::lock ( ) const

locks the texture buffer

◆ setBCI()

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

◆ setDrawGrid()

void icl::qt::GLImg::setDrawGrid ( bool  enabled,
float *  color = 0 
)

sets whether to visualize the pixel-grid or not

◆ setGridColor()

void icl::qt::GLImg::setGridColor ( float *  color)

sets the grid color

◆ setScaleMode()

void icl::qt::GLImg::setScaleMode ( core::scalemode  sm)

sets the texture interpolation mode

◆ unlock()

void icl::qt::GLImg::unlock ( ) const

unlocks the texture buffer

◆ update()

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

Member Data Documentation

◆ m_data

Data* icl::qt::GLImg::m_data
private

internal data structure

internal data pointer


The documentation for this class was generated from the following file: