Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
BIAS::ImgObjGL Class Reference

data holder describing OpenGL texture objects in addition to its unique texID. More...

#include <Gui/ImgObjGL.hh>

+ Collaboration diagram for BIAS::ImgObjGL:

Public Member Functions

void CreateGLCubemap (const std::vector< BIAS::ImageBase * > cm, const bool ImmediateCopyData=IMGOBJ_IMMEDIATE_COPY_DEFAULT, const bool mipmapped=IMGOBJ_DEFAULT_MIPMAPPED)
 
int CreateGLCubemap (const std::string &cm0PosX, const std::string &cm1NegX, const std::string &cm2PosY, const std::string &cm3NegY, const std::string &cm4PosZ, const std::string &cm5NegZ, const bool ImmediateCopyData=IMGOBJ_IMMEDIATE_COPY_DEFAULT, const bool mipmapped=IMGOBJ_DEFAULT_MIPMAPPED)
 helper creating cubemap from disk files More...
 
int CreateGLCubemap (const std::vector< std::string > cmFilenames, const bool ImmediateCopyData=IMGOBJ_IMMEDIATE_COPY_DEFAULT, const bool mipmapped=IMGOBJ_DEFAULT_MIPMAPPED)
 helper creating cubemap from disk files More...
 
void CreateGLCubemapEmpty (const unsigned int w, const unsigned int h, GLint gpu_internalFmt=GL_RGBA, const bool &mipmapped=false)
 
void CreateGLTexture (const BIAS::ImageBase &c_img, const bool &forcePow2tex=true, const bool &flipY=true, const bool ImmediateCopyData=IMGOBJ_IMMEDIATE_COPY_DEFAULT)
 
 creates an OpenGL texture from p_valueImage JW

if ImmediateCopyData is false the memory is just allocated and not copied from c_img. More...

 
void DeleteGLTexture ()
 deletes the texture memory and frees texture in GL More...
 
 ImgObjGL ()
 
 ImgObjGL (const GLuint &id, const unsigned int &widthBrutto, const unsigned int &heightBrutto, const GLenum &target=GL_TEXTURE_2D)
 
void InitMembers ()
 set members to defaults More...
 
bool IsCubemap () const
 
bool IsRectangleTexture () const
 
bool IsTexture2D () const
 
void Release ()
 frees the pointer members if we allocated them More...
 
void SetTarget2D ()
 
void SetTargetCUBE ()
 
void SetTargetPOW2 ()
 set the textur retarget to rectangular or pow 2 texture JW More...
 
void SetTargetRECT ()
 
 ~ImgObjGL ()
 

Static Public Member Functions

static GLint GetGLInternalFormat (const BIAS::ImageBase::EStorageType &biasST, const BIAS::ImageBase::EColorModel &biasCM, const unsigned int &channelcount, const unsigned int &ByteDepth, const unsigned int &BitDepth)
 JW determin the GPU internal format the src data should be mapped to. More...
 
static GLint GetGLInternalFormat (const BIAS::ImageBase &img)
 interface for the above More...
 
static GLenum GetGLPixelFormat (const BIAS::ImageBase::EColorModel &biasCM, const unsigned int &channelcount)
 get the GLenum pixel src format for the corresponding BIAS enum ColroModel More...
 
static GLenum GetGLStorageType (const BIAS::ImageBase::EStorageType &biasST, const unsigned int &ByteDepth)
 get the GLenum pixel storage type for the corresponding BIAS enum More...
 
static void InitGlew ()
 convenience interace for glewInit() c´with checks and ifdefs More...
 

Public Attributes

unsigned int heightBrutto
 
unsigned int heightOrig
 
GLuint id
 
GLenum magnificationMode
 
GLenum minificationMode
 
bool p_id_SelfAllocated
 
BIAS::ImageBasep_valueImage
 
bool p_valueImage_SelfAllocated
 
GLenum target
 
unsigned int widthBrutto
 
unsigned int widthOrig
 

Detailed Description

data holder describing OpenGL texture objects in addition to its unique texID.

Please note that querying glTexImage2D(GL_PROXY_TEXTURE_2D,... may be more reliable See http://www.opengl.org/resources/faq/technical/texture.htm

Bug:
TODO copy constructor that duplicates the GL pixel data required for std::vector.resize() (major bug, do not resize with std::vector for now!)
Author
Jan Woetzel

Definition at line 34 of file ImgObjGL.hh.

Constructor & Destructor Documentation

ImgObjGL::~ImgObjGL ( )

Definition at line 15 of file ImgObjGL.cpp.

ImgObjGL::ImgObjGL ( )

Definition at line 22 of file ImgObjGL.cpp.

References InitMembers().

ImgObjGL::ImgObjGL ( const GLuint &  id,
const unsigned int &  widthBrutto,
const unsigned int &  heightBrutto,
const GLenum &  target = GL_TEXTURE_2D 
)

Definition at line 30 of file ImgObjGL.cpp.

References heightBrutto, heightOrig, id, InitMembers(), target, widthBrutto, and widthOrig.

Member Function Documentation

void ImgObjGL::CreateGLCubemap ( const std::vector< BIAS::ImageBase * >  cm,
const bool  ImmediateCopyData = IMGOBJ_IMMEDIATE_COPY_DEFAULT,
const bool  mipmapped = IMGOBJ_DEFAULT_MIPMAPPED 
)
int ImgObjGL::CreateGLCubemap ( const std::string &  cm0PosX,
const std::string &  cm1NegX,
const std::string &  cm2PosY,
const std::string &  cm3NegY,
const std::string &  cm4PosZ,
const std::string &  cm5NegZ,
const bool  ImmediateCopyData = IMGOBJ_IMMEDIATE_COPY_DEFAULT,
const bool  mipmapped = IMGOBJ_DEFAULT_MIPMAPPED 
)

helper creating cubemap from disk files

Definition at line 568 of file ImgObjGL.cpp.

References CreateGLCubemap().

int ImgObjGL::CreateGLCubemap ( const std::vector< std::string >  cmFilenames,
const bool  ImmediateCopyData = IMGOBJ_IMMEDIATE_COPY_DEFAULT,
const bool  mipmapped = IMGOBJ_DEFAULT_MIPMAPPED 
)

helper creating cubemap from disk files

Definition at line 589 of file ImgObjGL.cpp.

References CreateGLCubemap(), and BIAS::ImageIO::Load().

void ImgObjGL::CreateGLCubemapEmpty ( const unsigned int  w,
const unsigned int  h,
GLint  gpu_internalFmt = GL_RGBA,
const bool &  mipmapped = false 
)
void ImgObjGL::CreateGLTexture ( const BIAS::ImageBase c_img,
const bool &  forcePow2tex = true,
const bool &  flipY = true,
const bool  ImmediateCopyData = IMGOBJ_IMMEDIATE_COPY_DEFAULT 
)
void ImgObjGL::DeleteGLTexture ( )

deletes the texture memory and frees texture in GL

Definition at line 120 of file ImgObjGL.cpp.

References target.

Referenced by Release().

GLint ImgObjGL::GetGLInternalFormat ( const BIAS::ImageBase::EStorageType biasST,
const BIAS::ImageBase::EColorModel biasCM,
const unsigned int &  channelcount,
const unsigned int &  ByteDepth,
const unsigned int &  BitDepth 
)
static

JW determin the GPU internal format the src data should be mapped to.

Author
Jan Woetzel

Definition at line 751 of file ImgObjGL.cpp.

References BIAS::ImageBase::GetSizeByte().

Referenced by CreateGLCubemap(), CreateGLTexture(), and GetGLInternalFormat().

GLint ImgObjGL::GetGLInternalFormat ( const BIAS::ImageBase img)
static
GLenum ImgObjGL::GetGLPixelFormat ( const BIAS::ImageBase::EColorModel biasCM,
const unsigned int &  channelcount 
)
static
GLenum ImgObjGL::GetGLStorageType ( const BIAS::ImageBase::EStorageType biasST,
const unsigned int &  ByteDepth 
)
static
void ImgObjGL::InitGlew ( )
static

convenience interace for glewInit() c´with checks and ifdefs

Definition at line 50 of file ImgObjGL.cpp.

Referenced by CreateGLCubemap(), CreateGLCubemapEmpty(), and CreateGLTexture().

void ImgObjGL::InitMembers ( )
bool ImgObjGL::IsCubemap ( ) const
Returns
true on cubemap texture

Definition at line 149 of file ImgObjGL.cpp.

References target.

bool ImgObjGL::IsRectangleTexture ( ) const
Returns
true if RECT texture (instead of 2D pow2 or cubemap)

Definition at line 140 of file ImgObjGL.cpp.

References target.

Referenced by CreateGLTexture(), and BIAS::GeometryGL::DisplayQuadTexCoord2D().

bool ImgObjGL::IsTexture2D ( ) const
Returns
true on classic GL_TEXTURE_2D target (instead of RECT or cubemap)

Definition at line 135 of file ImgObjGL.cpp.

References target.

void ImgObjGL::Release ( )

frees the pointer members if we allocated them

Definition at line 107 of file ImgObjGL.cpp.

References DeleteGLTexture(), p_id_SelfAllocated, p_valueImage, and p_valueImage_SelfAllocated.

Referenced by CreateGLCubemap(), CreateGLCubemapEmpty(), and CreateGLTexture().

void ImgObjGL::SetTarget2D ( )

Definition at line 161 of file ImgObjGL.cpp.

References target.

Referenced by SetTargetPOW2().

void ImgObjGL::SetTargetCUBE ( )

Definition at line 171 of file ImgObjGL.cpp.

References target.

void ImgObjGL::SetTargetPOW2 ( )

set the textur retarget to rectangular or pow 2 texture JW

Definition at line 158 of file ImgObjGL.cpp.

References SetTarget2D().

void ImgObjGL::SetTargetRECT ( )

Definition at line 164 of file ImgObjGL.cpp.

References target.

Referenced by BIAS::ImageCanvasGLBase::SetRECT().

Member Data Documentation

unsigned int BIAS::ImgObjGL::heightBrutto
unsigned int BIAS::ImgObjGL::heightOrig
GLuint BIAS::ImgObjGL::id
GLenum BIAS::ImgObjGL::magnificationMode
GLenum BIAS::ImgObjGL::minificationMode
bool BIAS::ImgObjGL::p_id_SelfAllocated
BIAS::ImageBase* BIAS::ImgObjGL::p_valueImage

Definition at line 155 of file ImgObjGL.hh.

Referenced by InitMembers(), Release(), and BIAS::ImageCanvasGLBase::Set().

bool BIAS::ImgObjGL::p_valueImage_SelfAllocated

Definition at line 159 of file ImgObjGL.hh.

Referenced by InitMembers(), Release(), and BIAS::ImageCanvasGLBase::Set().

GLenum BIAS::ImgObjGL::target
unsigned int BIAS::ImgObjGL::widthBrutto
unsigned int BIAS::ImgObjGL::widthOrig

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