Changeset 2877 for trunk/packages/vizservers/nanovis/Texture3D.cpp
- Timestamp:
- Mar 23, 2012, 1:31:05 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/nanovis/Texture3D.cpp
r2857 r2877 88 88 void Texture3D::update(void *data) 89 89 { 90 static GLuint floatFormats[] = { -1, GL_LUMINANCE32F_ARB, GL_LUMINANCE_ALPHA32F_ARB, GL_RGB32F_ARB, GL_RGBA32F_ARB }; 91 static GLuint halfFloatFormats[] = { -1, GL_LUMINANCE16F_ARB, GL_LUMINANCE_ALPHA16F_ARB, GL_RGB16F_ARB, GL_RGBA16F_ARB }; 92 static GLuint basicFormats[] = { -1, GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_RGB, GL_RGBA }; 93 90 94 glBindTexture(GL_TEXTURE_3D, _id); 91 95 92 //load texture with 16 bit half floating point precision if card is 6 series NV4093 //half float with linear interpolation is only supported by 6 series and up cards94 //If NV40 not defined, data is quantized to 8-bit from 32-bit.95 96 glPixelStorei(GL_UNPACK_ALIGNMENT, 1); 96 97 … … 103 104 104 105 //to do: add handling to more formats 105 #ifdef NV40 106 GLuint *targetFormats; 107 #ifdef HAVE_FLOAT_TEXTURES 106 108 if (_type == GL_FLOAT) { 107 GLuint targetFormat[5] = { -1, GL_LUMINANCE16F_ARB, GL_LUMINANCE_ALPHA16F_ARB, GL_RGB16F_ARB, GL_RGBA16F_ARB }; 108 GLuint format[5] = { -1, GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_RGB, GL_RGBA };109 glTexImage3D(GL_TEXTURE_3D, 0, targetFormat[_numComponents], 110 _width, _height, _depth, 0,111 format[_numComponents], _type, data); 109 # ifdef USE_HALF_FLOAT 110 targetFormats = halfFloatFormats; 111 # else 112 targetFormats = floatFormats; 113 # endif 112 114 } else { 113 115 #endif 114 GLuint format[5] = { -1, GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_RGB, GL_RGBA }; 115 glTexImage3D(GL_TEXTURE_3D, 0, format[_numComponents], 116 _width, _height, _depth, 0, 117 format[_numComponents], _type, data); 118 #ifdef NV40 116 targetFormats = basicFormats; 117 #ifdef HAVE_FLOAT_TEXTURES 119 118 } 120 119 #endif 120 121 glTexImage3D(GL_TEXTURE_3D, 0, targetFormats[_numComponents], 122 _width, _height, _depth, 0, 123 basicFormats[_numComponents], _type, data); 121 124 122 125 assert(glGetError()==0);
Note: See TracChangeset
for help on using the changeset viewer.