DGtal  0.9.3
Public Member Functions | Data Fields
DGtal::Viewer3D< Space, KSpace >::GLTextureImage Struct Reference
Collaboration diagram for DGtal::Viewer3D< Space, KSpace >::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 Space = SpaceND<3>, typename KSpace = KhalimskySpaceND<3>>
struct DGtal::Viewer3D< Space, KSpace >::GLTextureImage

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

Definition at line 1040 of file Viewer3D.h.

Constructor & Destructor Documentation

◆ ~GLTextureImage()

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

Definition at line 1067 of file Viewer3D.h.

1068  {
1069  if(myMode== 1)
1070  {
1071  if(myTextureImageBufferGS!=0)
1072  delete [] myTextureImageBufferGS;
1073  }
1075  {
1077  delete [] myTextureImageBufferRGB;
1078  }
1079 
1080  }
Viewer3D< Space, KSpace >::TextureMode myMode
Definition: Viewer3D.h:1055
unsigned char * myTextureImageBufferGS
Definition: Viewer3D.h:1056
unsigned char * myTextureImageBufferRGB
Definition: Viewer3D.h:1057

◆ GLTextureImage() [1/2]

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

Definition at line 1083 of file Viewer3D.h.

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

1083  : myBufferWidth(aGLImg.myBufferWidth),
1084  myBufferHeight(aGLImg.myBufferHeight),
1085  myTextureName(aGLImg.myTextureName),
1086  myMode(aGLImg.myMode),
1087  myTextureFitX(aGLImg.myTextureFitX),
1088  myTextureFitY(aGLImg.myTextureFitY)
1089 
1090  {
1091  point1[0]=aGLImg.point1[0]; point1[1]=aGLImg.point1[1]; point1[2]=aGLImg.point1[2];
1092  point2[0]=aGLImg.point2[0]; point2[1]=aGLImg.point2[1]; point2[2]=aGLImg.point2[2];
1093  point3[0]=aGLImg.point3[0]; point3[1]=aGLImg.point3[1]; point3[2]=aGLImg.point3[2];
1094  point4[0]=aGLImg.point4[0]; point4[1]=aGLImg.point4[1]; point4[2]=aGLImg.point4[2];
1095  myImageWidth=aGLImg.myImageWidth; myImageHeight=aGLImg.myImageHeight;
1096  myDirection = aGLImg.myDirection;
1097  vectNormal[0]=aGLImg.vectNormal[0];
1098  vectNormal[1]=aGLImg.vectNormal[1];
1099  vectNormal[2]=aGLImg.vectNormal[2];
1100 
1101  if(myMode== 1)
1102  {
1103  myTextureImageBufferGS = new unsigned char [myBufferHeight*myBufferWidth];
1104  for(unsigned int i=0; i<myBufferHeight*myBufferWidth;i++)
1105  {
1106  myTextureImageBufferGS[i]=aGLImg.myTextureImageBufferGS[i];
1107  }
1109  {
1110  myTextureImageBufferRGB = new unsigned char [3*myBufferHeight*myBufferWidth];
1111  for(unsigned int i=0; i<3*myBufferHeight*myBufferWidth;i+=3)
1112  {
1113  myTextureImageBufferRGB[i]=aGLImg.myTextureImageBufferRGB[i];
1114  myTextureImageBufferRGB[i+1]=aGLImg.myTextureImageBufferRGB[i+1];
1115  myTextureImageBufferRGB[i+2]=aGLImg.myTextureImageBufferRGB[i+2];
1116  }
1117  }
1118  }
Viewer3D< Space, KSpace >::ImageDirection myDirection
Definition: Viewer3D.h:1048
Viewer3D< Space, KSpace >::TextureMode myMode
Definition: Viewer3D.h:1055
unsigned char * myTextureImageBufferGS
Definition: Viewer3D.h:1056
unsigned char * myTextureImageBufferRGB
Definition: Viewer3D.h:1057
RealPoint point1
coordinates
Definition: Viewer3D.h:1043

◆ GLTextureImage() [2/2]

template<typename Space = SpaceND<3>, typename KSpace = KhalimskySpaceND<3>>
DGtal::Viewer3D< Space, KSpace >::GLTextureImage::GLTextureImage ( const typename Viewer3D< Space, KSpace >::TextureImage aGSImage)
inline

Definition at line 1122 of file Viewer3D.h.

References DGtal::Color::blue(), DGtal::Color::green(), DGtal::Viewer3D< Space, KSpace >::TextureImage::myDirection, DGtal::Viewer3D< Space, KSpace >::TextureImage::myImageHeight, DGtal::Viewer3D< Space, KSpace >::TextureImage::myImageWidth, DGtal::Viewer3D< Space, KSpace >::TextureImage::myMode, DGtal::Viewer3D< Space, KSpace >::TextureImage::myTabImage, DGtal::Viewer3D< Space, KSpace >::Image2DDomainD3D::point1, DGtal::Viewer3D< Space, KSpace >::TextureImage::point1, DGtal::Viewer3D< Space, KSpace >::TextureImage::point2, DGtal::Viewer3D< Space, KSpace >::TextureImage::point3, DGtal::Viewer3D< Space, KSpace >::TextureImage::point4, DGtal::Color::red(), and DGtal::functions::roundToUpperPowerOfTwo().

1123  {
1124  point1[0]=aGSImage.point1[0]; point1[1]=aGSImage.point1[1]; point1[2]=aGSImage.point1[2];
1125  point2[0]=aGSImage.point2[0]; point2[1]=aGSImage.point2[1]; point2[2]=aGSImage.point2[2];
1126  point3[0]=aGSImage.point3[0]; point3[1]=aGSImage.point3[1]; point3[2]=aGSImage.point3[2];
1127  point4[0]=aGSImage.point4[0]; point4[1]=aGSImage.point4[1]; point4[2]=aGSImage.point4[2];
1128  myImageWidth=aGSImage.myImageWidth; myImageHeight=aGSImage.myImageHeight;
1129  myDirection = aGSImage.myDirection;
1130  myMode= aGSImage.myMode;
1135  RealPoint v1 = point2-point1;
1136  RealPoint v2 = point4-point1;
1137  vectNormal[0] = v1[1]*v2[2] - v1[2]*v2[1];
1138  vectNormal[1] = v1[2]*v2[0] - v1[0]*v2[2];
1139  vectNormal[2] = v1[0]*v2[1] - v1[1]*v2[0];
1140  double norm = sqrt(vectNormal[0]*vectNormal[0]+vectNormal[1]*vectNormal[1]+vectNormal[2]*vectNormal[2]);
1141  vectNormal[0] /=norm; vectNormal[1] /=norm; vectNormal[2] /=norm;
1142  }
1143 
1146 
1147  if(myMode== 1)
1148  {
1149  myTextureImageBufferGS = new unsigned char [myBufferHeight*myBufferWidth];
1150  unsigned int pos=0;
1151  for (unsigned int i=0; i<myBufferHeight; i++)
1152  {
1153  for (unsigned int j=0; j<myBufferWidth; j++)
1154  {
1155  if(i<myImageHeight && j< myImageWidth)
1156  {
1157  myTextureImageBufferGS[pos]= aGSImage.myTabImage[i*myImageWidth+j];
1158  }else{
1159  myTextureImageBufferGS[pos]=0;
1160  }
1161  pos++;
1162  }
1163  }
1165  {
1166  myTextureImageBufferRGB = new unsigned char [3*myBufferHeight*myBufferWidth];
1167  unsigned int pos=0;
1168  for (unsigned int i=0; i<myBufferHeight; i++)
1169  {
1170  for (unsigned int j=0; j<myBufferWidth; j++)
1171  {
1172  if(i<myImageHeight && j< myImageWidth)
1173  {
1174  DGtal::Color aCol(aGSImage.myTabImage[i*myImageWidth+j]);
1175  myTextureImageBufferRGB[pos]= aCol.red();
1176  myTextureImageBufferRGB[pos+1]= aCol.green();
1177  myTextureImageBufferRGB[pos+2]= aCol.blue();
1178  }else{
1179  myTextureImageBufferRGB[pos]=0;
1180  myTextureImageBufferRGB[pos+1]=0;
1181  myTextureImageBufferRGB[pos+2]=0;
1182  }
1183  pos+=3;
1184  }
1185  }
1186  }
1187 
1188  myTextureFitX = 1.0-((myBufferWidth-myImageWidth)/(double)myBufferWidth);
1189  myTextureFitY = 1.0-((myBufferHeight-myImageHeight)/(double)myBufferHeight);
1190  }
Viewer3D< Space, KSpace >::ImageDirection myDirection
Definition: Viewer3D.h:1048
Viewer3D< Space, KSpace >::TextureMode myMode
Definition: Viewer3D.h:1055
unsigned char * myTextureImageBufferGS
Definition: Viewer3D.h:1056
Display::RealPoint RealPoint
Definition: Viewer3D.h:145
unsigned char * myTextureImageBufferRGB
Definition: Viewer3D.h:1057
T roundToUpperPowerOfTwo(const T &n)
Structure representing an RGB triple with alpha component.
Definition: Color.h:66
RealPoint point1
coordinates
Definition: Viewer3D.h:1043

Field Documentation

◆ myBufferHeight

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

Definition at line 1053 of file Viewer3D.h.

◆ myBufferWidth

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

Definition at line 1052 of file Viewer3D.h.

◆ myDirection

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

◆ myImageHeight

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

◆ myImageWidth

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

◆ myMode

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

Definition at line 1055 of file Viewer3D.h.

◆ myTextureFitX

template<typename Space = SpaceND<3>, typename KSpace = KhalimskySpaceND<3>>
double DGtal::Viewer3D< Space, KSpace >::GLTextureImage::myTextureFitX

Definition at line 1062 of file Viewer3D.h.

◆ myTextureFitY

template<typename Space = SpaceND<3>, typename KSpace = KhalimskySpaceND<3>>
double DGtal::Viewer3D< Space, KSpace >::GLTextureImage::myTextureFitY

Definition at line 1063 of file Viewer3D.h.

◆ myTextureImageBufferGS

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

◆ myTextureImageBufferRGB

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

◆ myTextureName

template<typename Space = SpaceND<3>, typename KSpace = KhalimskySpaceND<3>>
GLuint DGtal::Viewer3D< Space, KSpace >::GLTextureImage::myTextureName

Definition at line 1054 of file Viewer3D.h.

◆ point1

template<typename Space = SpaceND<3>, typename KSpace = KhalimskySpaceND<3>>
RealPoint DGtal::Viewer3D< Space, KSpace >::GLTextureImage::point1

coordinates

Definition at line 1043 of file Viewer3D.h.

Referenced by DGtal::Viewer3D< Space, KSpace >::GLTextureImage::GLTextureImage().

◆ point2

template<typename Space = SpaceND<3>, typename KSpace = KhalimskySpaceND<3>>
RealPoint DGtal::Viewer3D< Space, KSpace >::GLTextureImage::point2

◆ point3

template<typename Space = SpaceND<3>, typename KSpace = KhalimskySpaceND<3>>
RealPoint DGtal::Viewer3D< Space, KSpace >::GLTextureImage::point3

◆ point4

template<typename Space = SpaceND<3>, typename KSpace = KhalimskySpaceND<3>>
RealPoint DGtal::Viewer3D< Space, KSpace >::GLTextureImage::point4

◆ vectNormal

template<typename Space = SpaceND<3>, typename KSpace = KhalimskySpaceND<3>>
double DGtal::Viewer3D< Space, KSpace >::GLTextureImage::vectNormal[3]

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