DGtal  0.9.4beta
Public Member Functions | Data Fields
DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage Struct Reference
Collaboration diagram for DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage:
[legend]

Public Member Functions

 ~GLTextureImage ()
 
 GLTextureImage (const GLTextureImage &aGLImg)
 
 GLTextureImage (const typename Viewer3D< Space, KSpace >::TextureImage &aGSImage)
 

Data Fields

RealPoint point1
 
RealPoint point2
 
RealPoint point3
 
RealPoint point4
 
Viewer3D< Space, KSpace >::ImageDirection myDirection
 
unsigned int myImageWidth
 
unsigned int myImageHeight
 
unsigned int myBufferWidth
 
unsigned int myBufferHeight
 
GLuint myTextureName
 
Viewer3D< Space, KSpace >::TextureMode myMode
 
unsigned char * myTextureImageBufferGS
 
unsigned char * myTextureImageBufferRGB
 
double vectNormal [3]
 
double myTextureFitX
 
double myTextureFitY
 

Detailed Description

template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
struct DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage

Used to display in OPENGL an image as a textured quad image.

Definition at line 1207 of file Viewer3D.h.

Constructor & Destructor Documentation

template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::~GLTextureImage ( )
inline

Definition at line 1234 of file Viewer3D.h.

References DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::myTextureImageBufferGS, and DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::myTextureImageBufferRGB.

1235  {
1236  if(myMode== 1)
1237  {
1238  if(myTextureImageBufferGS!=0)
1239  delete [] myTextureImageBufferGS;
1240  }
1242  {
1244  delete [] myTextureImageBufferRGB;
1245  }
1246 
1247  }
unsigned char * myTextureImageBufferGS
Definition: Viewer3D.h:1223
unsigned char * myTextureImageBufferRGB
Definition: Viewer3D.h:1224
Viewer3D< Space, KSpace >::TextureMode myMode
Definition: Viewer3D.h:1222
template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::GLTextureImage ( const GLTextureImage aGLImg)
inline

Definition at line 1250 of file Viewer3D.h.

References DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::myBufferWidth, DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::myDirection, DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::myImageHeight, DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::myImageWidth, DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::myTextureImageBufferGS, DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::myTextureImageBufferRGB, DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::point1, DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::point2, DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::point3, DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::point4, and DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::vectNormal.

1250  : myBufferWidth(aGLImg.myBufferWidth),
1251  myBufferHeight(aGLImg.myBufferHeight),
1252  myTextureName(aGLImg.myTextureName),
1253  myMode(aGLImg.myMode),
1254  myTextureFitX(aGLImg.myTextureFitX),
1255  myTextureFitY(aGLImg.myTextureFitY)
1256 
1257  {
1258  point1[0]=aGLImg.point1[0]; point1[1]=aGLImg.point1[1]; point1[2]=aGLImg.point1[2];
1259  point2[0]=aGLImg.point2[0]; point2[1]=aGLImg.point2[1]; point2[2]=aGLImg.point2[2];
1260  point3[0]=aGLImg.point3[0]; point3[1]=aGLImg.point3[1]; point3[2]=aGLImg.point3[2];
1261  point4[0]=aGLImg.point4[0]; point4[1]=aGLImg.point4[1]; point4[2]=aGLImg.point4[2];
1262  myImageWidth=aGLImg.myImageWidth; myImageHeight=aGLImg.myImageHeight;
1263  myDirection = aGLImg.myDirection;
1264  vectNormal[0]=aGLImg.vectNormal[0];
1265  vectNormal[1]=aGLImg.vectNormal[1];
1266  vectNormal[2]=aGLImg.vectNormal[2];
1267 
1268  if(myMode== 1)
1269  {
1270  myTextureImageBufferGS = new unsigned char [myBufferHeight*myBufferWidth];
1271  for(unsigned int i=0; i<myBufferHeight*myBufferWidth;i++)
1272  {
1273  myTextureImageBufferGS[i]=aGLImg.myTextureImageBufferGS[i];
1274  }
1276  {
1277  myTextureImageBufferRGB = new unsigned char [3*myBufferHeight*myBufferWidth];
1278  for(unsigned int i=0; i<3*myBufferHeight*myBufferWidth;i+=3)
1279  {
1280  myTextureImageBufferRGB[i]=aGLImg.myTextureImageBufferRGB[i];
1281  myTextureImageBufferRGB[i+1]=aGLImg.myTextureImageBufferRGB[i+1];
1282  myTextureImageBufferRGB[i+2]=aGLImg.myTextureImageBufferRGB[i+2];
1283  }
1284  }
1285  }
RealPoint point1
coordinates
Definition: Viewer3D.h:1210
unsigned char * myTextureImageBufferGS
Definition: Viewer3D.h:1223
Viewer3D< Space, KSpace >::ImageDirection myDirection
Definition: Viewer3D.h:1215
unsigned char * myTextureImageBufferRGB
Definition: Viewer3D.h:1224
Viewer3D< Space, KSpace >::TextureMode myMode
Definition: Viewer3D.h:1222
template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::GLTextureImage ( const typename Viewer3D< Space, KSpace >::TextureImage aGSImage)
inline

Definition at line 1289 of file Viewer3D.h.

References DGtal::Color::blue(), DGtal::Color::green(), DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::myBufferHeight, DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::myBufferWidth, DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::myImageHeight, DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::myImageWidth, DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::point1, DGtal::Color::red(), DGtal::functions::roundToUpperPowerOfTwo(), and DGtal::Viewer3D< TSpace, TKSpace >::undefDirection.

1290  {
1291  point1[0]=aGSImage.point1[0]; point1[1]=aGSImage.point1[1]; point1[2]=aGSImage.point1[2];
1292  point2[0]=aGSImage.point2[0]; point2[1]=aGSImage.point2[1]; point2[2]=aGSImage.point2[2];
1293  point3[0]=aGSImage.point3[0]; point3[1]=aGSImage.point3[1]; point3[2]=aGSImage.point3[2];
1294  point4[0]=aGSImage.point4[0]; point4[1]=aGSImage.point4[1]; point4[2]=aGSImage.point4[2];
1295  myImageWidth=aGSImage.myImageWidth; myImageHeight=aGSImage.myImageHeight;
1296  myDirection = aGSImage.myDirection;
1297  myMode= aGSImage.myMode;
1302  RealPoint v1 = point2-point1;
1303  RealPoint v2 = point4-point1;
1304  vectNormal[0] = v1[1]*v2[2] - v1[2]*v2[1];
1305  vectNormal[1] = v1[2]*v2[0] - v1[0]*v2[2];
1306  vectNormal[2] = v1[0]*v2[1] - v1[1]*v2[0];
1307  double norm = sqrt(vectNormal[0]*vectNormal[0]+vectNormal[1]*vectNormal[1]+vectNormal[2]*vectNormal[2]);
1308  vectNormal[0] /=norm; vectNormal[1] /=norm; vectNormal[2] /=norm;
1309  }
1310 
1313 
1314  if(myMode== 1)
1315  {
1316  myTextureImageBufferGS = new unsigned char [myBufferHeight*myBufferWidth];
1317  unsigned int pos=0;
1318  for (unsigned int i=0; i<myBufferHeight; i++)
1319  {
1320  for (unsigned int j=0; j<myBufferWidth; j++)
1321  {
1322  if(i<myImageHeight && j< myImageWidth)
1323  {
1324  myTextureImageBufferGS[pos]= aGSImage.myTabImage[i*myImageWidth+j];
1325  }else{
1326  myTextureImageBufferGS[pos]=0;
1327  }
1328  pos++;
1329  }
1330  }
1332  {
1333  myTextureImageBufferRGB = new unsigned char [3*myBufferHeight*myBufferWidth];
1334  unsigned int pos=0;
1335  for (unsigned int i=0; i<myBufferHeight; i++)
1336  {
1337  for (unsigned int j=0; j<myBufferWidth; j++)
1338  {
1339  if(i<myImageHeight && j< myImageWidth)
1340  {
1341  DGtal::Color aCol(aGSImage.myTabImage[i*myImageWidth+j]);
1342  myTextureImageBufferRGB[pos]= aCol.red();
1343  myTextureImageBufferRGB[pos+1]= aCol.green();
1344  myTextureImageBufferRGB[pos+2]= aCol.blue();
1345  }else{
1346  myTextureImageBufferRGB[pos]=0;
1347  myTextureImageBufferRGB[pos+1]=0;
1348  myTextureImageBufferRGB[pos+2]=0;
1349  }
1350  pos+=3;
1351  }
1352  }
1353  }
1354 
1355  myTextureFitX = 1.0-((myBufferWidth-myImageWidth)/(double)myBufferWidth);
1356  myTextureFitY = 1.0-((myBufferHeight-myImageHeight)/(double)myBufferHeight);
1357  }
RealPoint point1
coordinates
Definition: Viewer3D.h:1210
unsigned char * myTextureImageBufferGS
Definition: Viewer3D.h:1223
Viewer3D< Space, KSpace >::ImageDirection myDirection
Definition: Viewer3D.h:1215
unsigned char * myTextureImageBufferRGB
Definition: Viewer3D.h:1224
Display::RealPoint RealPoint
Definition: Viewer3D.h:146
Viewer3D< Space, KSpace >::TextureMode myMode
Definition: Viewer3D.h:1222
T roundToUpperPowerOfTwo(const T &n)
Structure representing an RGB triple with alpha component.
Definition: Color.h:66

Field Documentation

template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
unsigned int DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::myBufferHeight
template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
unsigned int DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::myBufferWidth
template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
Viewer3D<Space, KSpace>::ImageDirection DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::myDirection
template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
unsigned int DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::myImageHeight
template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
unsigned int DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::myImageWidth
template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
Viewer3D<Space, KSpace>::TextureMode DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::myMode

Definition at line 1222 of file Viewer3D.h.

template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
double DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::myTextureFitX

Definition at line 1229 of file Viewer3D.h.

template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
double DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::myTextureFitY

Definition at line 1230 of file Viewer3D.h.

template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
unsigned char* DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::myTextureImageBufferGS
template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
unsigned char* DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::myTextureImageBufferRGB
template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
GLuint DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::myTextureName

Definition at line 1221 of file Viewer3D.h.

template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
RealPoint DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::point1

coordinates

Definition at line 1210 of file Viewer3D.h.

Referenced by DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::GLTextureImage().

template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
RealPoint DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::point2
template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
RealPoint DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::point3
template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
RealPoint DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::point4
template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
double DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::vectNormal[3]

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