DGtal  1.4.beta
Public Member Functions | Data Fields
DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage Struct Reference

Public Member Functions

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

Data Fields

RealPoint point1
 coordinates More...
 
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 1208 of file Viewer3D.h.

Constructor & Destructor Documentation

◆ ~GLTextureImage()

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

◆ GLTextureImage() [1/2]

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

Definition at line 1251 of file Viewer3D.h.

1251  : myBufferWidth(aGLImg.myBufferWidth),
1252  myBufferHeight(aGLImg.myBufferHeight),
1253  myTextureName(aGLImg.myTextureName),
1254  myMode(aGLImg.myMode),
1255  myTextureFitX(aGLImg.myTextureFitX),
1256  myTextureFitY(aGLImg.myTextureFitY)
1257 
1258  {
1259  point1[0]=aGLImg.point1[0]; point1[1]=aGLImg.point1[1]; point1[2]=aGLImg.point1[2];
1260  point2[0]=aGLImg.point2[0]; point2[1]=aGLImg.point2[1]; point2[2]=aGLImg.point2[2];
1261  point3[0]=aGLImg.point3[0]; point3[1]=aGLImg.point3[1]; point3[2]=aGLImg.point3[2];
1262  point4[0]=aGLImg.point4[0]; point4[1]=aGLImg.point4[1]; point4[2]=aGLImg.point4[2];
1263  myImageWidth=aGLImg.myImageWidth; myImageHeight=aGLImg.myImageHeight;
1264  myDirection = aGLImg.myDirection;
1265  vectNormal[0]=aGLImg.vectNormal[0];
1266  vectNormal[1]=aGLImg.vectNormal[1];
1267  vectNormal[2]=aGLImg.vectNormal[2];
1268 
1269  if(myMode== 1)
1270  {
1271  myTextureImageBufferGS = new unsigned char [myBufferHeight*myBufferWidth];
1272  for(unsigned int i=0; i<myBufferHeight*myBufferWidth;i++)
1273  {
1274  myTextureImageBufferGS[i]=aGLImg.myTextureImageBufferGS[i];
1275  }
1277  {
1278  myTextureImageBufferRGB = new unsigned char [3*myBufferHeight*myBufferWidth];
1279  for(unsigned int i=0; i<3*myBufferHeight*myBufferWidth;i+=3)
1280  {
1281  myTextureImageBufferRGB[i]=aGLImg.myTextureImageBufferRGB[i];
1282  myTextureImageBufferRGB[i+1]=aGLImg.myTextureImageBufferRGB[i+1];
1283  myTextureImageBufferRGB[i+2]=aGLImg.myTextureImageBufferRGB[i+2];
1284  }
1285  }
1286  }

References DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::myBufferHeight, 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::myMode, 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.

◆ GLTextureImage() [2/2]

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 1290 of file Viewer3D.h.

1291  {
1292  point1[0]=aGSImage.point1[0]; point1[1]=aGSImage.point1[1]; point1[2]=aGSImage.point1[2];
1293  point2[0]=aGSImage.point2[0]; point2[1]=aGSImage.point2[1]; point2[2]=aGSImage.point2[2];
1294  point3[0]=aGSImage.point3[0]; point3[1]=aGSImage.point3[1]; point3[2]=aGSImage.point3[2];
1295  point4[0]=aGSImage.point4[0]; point4[1]=aGSImage.point4[1]; point4[2]=aGSImage.point4[2];
1296  myImageWidth=aGSImage.myImageWidth; myImageHeight=aGSImage.myImageHeight;
1297  myDirection = aGSImage.myDirection;
1298  myMode= aGSImage.myMode;
1303  RealPoint v1 = point2-point1;
1304  RealPoint v2 = point4-point1;
1305  vectNormal[0] = v1[1]*v2[2] - v1[2]*v2[1];
1306  vectNormal[1] = v1[2]*v2[0] - v1[0]*v2[2];
1307  vectNormal[2] = v1[0]*v2[1] - v1[1]*v2[0];
1308  double norm = sqrt(vectNormal[0]*vectNormal[0]+vectNormal[1]*vectNormal[1]+vectNormal[2]*vectNormal[2]);
1309  vectNormal[0] /=norm; vectNormal[1] /=norm; vectNormal[2] /=norm;
1310  }
1311 
1314 
1315  if(myMode== 1)
1316  {
1317  myTextureImageBufferGS = new unsigned char [myBufferHeight*myBufferWidth];
1318  unsigned int pos=0;
1319  for (unsigned int i=0; i<myBufferHeight; i++)
1320  {
1321  for (unsigned int j=0; j<myBufferWidth; j++)
1322  {
1323  if(i<myImageHeight && j< myImageWidth)
1324  {
1325  myTextureImageBufferGS[pos]= aGSImage.myTabImage[i*myImageWidth+j];
1326  }else{
1327  myTextureImageBufferGS[pos]=0;
1328  }
1329  pos++;
1330  }
1331  }
1333  {
1334  myTextureImageBufferRGB = new unsigned char [3*myBufferHeight*myBufferWidth];
1335  unsigned int pos=0;
1336  for (unsigned int i=0; i<myBufferHeight; i++)
1337  {
1338  for (unsigned int j=0; j<myBufferWidth; j++)
1339  {
1340  if(i<myImageHeight && j< myImageWidth)
1341  {
1342  DGtal::Color aCol(aGSImage.myTabImage[i*myImageWidth+j]);
1343  myTextureImageBufferRGB[pos]= aCol.red();
1344  myTextureImageBufferRGB[pos+1]= aCol.green();
1345  myTextureImageBufferRGB[pos+2]= aCol.blue();
1346  }else{
1347  myTextureImageBufferRGB[pos]=0;
1348  myTextureImageBufferRGB[pos+1]=0;
1349  myTextureImageBufferRGB[pos+2]=0;
1350  }
1351  pos+=3;
1352  }
1353  }
1354  }
1355 
1358  }

References DGtal::Color::blue(), DGtal::Color::green(), DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::myBufferHeight, 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::myMode, DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::myTextureFitX, DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::myTextureFitY, 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, DGtal::Color::red(), DGtal::functions::roundToUpperPowerOfTwo(), DGtal::Viewer3D< TSpace, TKSpace >::undefDirection, and DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::vectNormal.

Field Documentation

◆ myBufferHeight

template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
unsigned int DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::myBufferHeight

◆ myBufferWidth

template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
unsigned int DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::myBufferWidth

◆ myDirection

template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
Viewer3D<Space, KSpace>::ImageDirection DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::myDirection

◆ myImageHeight

template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
unsigned int DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::myImageHeight

◆ myImageWidth

template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
unsigned int DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::myImageWidth

◆ myMode

template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
Viewer3D<Space, KSpace>::TextureMode DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::myMode

◆ myTextureFitX

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

◆ myTextureFitY

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

◆ myTextureImageBufferGS

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

◆ myTextureImageBufferRGB

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

◆ myTextureName

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

Definition at line 1222 of file Viewer3D.h.

◆ point1

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

coordinates

Definition at line 1211 of file Viewer3D.h.

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

◆ point2

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

◆ point3

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

◆ point4

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

◆ vectNormal

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:
DGtal::Viewer3D::GLTextureImage::myTextureName
GLuint myTextureName
Definition: Viewer3D.h:1222
DGtal::Viewer3D< Space, KSpace >::RGBMode
@ RGBMode
Definition: Viewer3D.h:472
DGtal::Viewer3D::GLTextureImage::myDirection
Viewer3D< Space, KSpace >::ImageDirection myDirection
Definition: Viewer3D.h:1216
DGtal::Viewer3D::undefDirection
@ undefDirection
Definition: Viewer3D.h:470
DGtal::Viewer3D::GLTextureImage::myBufferWidth
unsigned int myBufferWidth
Definition: Viewer3D.h:1220
DGtal::Color
Structure representing an RGB triple with alpha component.
Definition: Color.h:67
DGtal::functions::roundToUpperPowerOfTwo
T roundToUpperPowerOfTwo(const T &n)
Definition: BasicMathFunctions.h:102
DGtal::Viewer3D::GLTextureImage::myTextureImageBufferGS
unsigned char * myTextureImageBufferGS
Definition: Viewer3D.h:1224
DGtal::Viewer3D::GLTextureImage::point1
RealPoint point1
coordinates
Definition: Viewer3D.h:1211
DGtal::Viewer3D< Space, KSpace >::yDirection
@ yDirection
Definition: Viewer3D.h:470
DGtal::Viewer3D< Space, KSpace >::zDirection
@ zDirection
Definition: Viewer3D.h:470
DGtal::Viewer3D::GLTextureImage::myBufferHeight
unsigned int myBufferHeight
Definition: Viewer3D.h:1221
DGtal::Viewer3D::GLTextureImage::point3
RealPoint point3
Definition: Viewer3D.h:1213
DGtal::Viewer3D::GLTextureImage::myImageHeight
unsigned int myImageHeight
Definition: Viewer3D.h:1218
DGtal::Viewer3D::GLTextureImage::myTextureFitY
double myTextureFitY
Definition: Viewer3D.h:1231
DGtal::Viewer3D::GLTextureImage::myTextureImageBufferRGB
unsigned char * myTextureImageBufferRGB
Definition: Viewer3D.h:1225
DGtal::Viewer3D::GLTextureImage::myMode
Viewer3D< Space, KSpace >::TextureMode myMode
Definition: Viewer3D.h:1223
DGtal::Viewer3D::GLTextureImage::myImageWidth
unsigned int myImageWidth
Definition: Viewer3D.h:1217
DGtal::Viewer3D::GLTextureImage::point4
RealPoint point4
Definition: Viewer3D.h:1214
DGtal::PointVector
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:165
DGtal::Viewer3D< Space, KSpace >::xDirection
@ xDirection
Definition: Viewer3D.h:470
DGtal::Viewer3D::GLTextureImage::vectNormal
double vectNormal[3]
Definition: Viewer3D.h:1226
DGtal::Viewer3D::GLTextureImage::myTextureFitX
double myTextureFitX
Definition: Viewer3D.h:1230
DGtal::Viewer3D::GLTextureImage::point2
RealPoint point2
Definition: Viewer3D.h:1212