56 #include "Texture3DNode.hh" 66 Texture3DNode::Texture3DNode(
BaseNode * _parent,
67 const std::string & _name )
70 tex_mode_( GL_MODULATE ),
71 border_color_( 0, 0, 0, 0 ),
72 wrap_mode_( GL_CLAMP ),
80 Texture3DNode::~Texture3DNode()
96 glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, tex_mode_);
97 glTexParameterfv( GL_TEXTURE_3D, GL_TEXTURE_BORDER_COLOR, border_color_.data() );
99 glTexParameteri( GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, wrap_mode_ );
100 glTexParameteri( GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, wrap_mode_ );
101 glTexParameteri( GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, wrap_mode_ );
103 glTexParameteri( GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, filter_ );
104 glTexParameteri( GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, filter_ );
124 Texture3DNode::set_texture(
unsigned int _width,
125 unsigned int _height,
127 unsigned char * _data )
129 glTexImage3D( GL_PROXY_TEXTURE_3D, 0, GL_RGBA,
130 _width, _height, _depth, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL );
133 glGetTexLevelParameteriv( GL_PROXY_TEXTURE_3D, 0,
134 GL_TEXTURE_WIDTH, & test_width );
137 glGetTexLevelParameteriv( GL_PROXY_TEXTURE_3D, 0,
138 GL_TEXTURE_HEIGHT, & test_height );
141 glGetTexLevelParameteriv( GL_PROXY_TEXTURE_3D, 0,
142 GL_TEXTURE_DEPTH, & test_depth );
144 if ( ! test_width || ! test_height || ! test_depth )
146 std::cerr <<
"Can't load texture.\n";
150 glPixelStorei( GL_UNPACK_ROW_LENGTH, 0 );
151 glPixelStorei( GL_UNPACK_SKIP_ROWS, 0 );
152 glPixelStorei( GL_UNPACK_SKIP_PIXELS, 0 );
153 glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
154 glPixelStorei( GL_PACK_ROW_LENGTH, 0 );
155 glPixelStorei( GL_PACK_SKIP_ROWS, 0 );
156 glPixelStorei( GL_PACK_SKIP_PIXELS, 0 );
157 glPixelStorei( GL_PACK_ALIGNMENT, 1 );
166 glTexImage3D( GL_TEXTURE_3D, 0, GL_RGBA,
167 _width, _height, _depth, 0, GL_RGBA, GL_UNSIGNED_BYTE, _data );
Namespace providing different geometric functions concerning angles.
void leave(GLState &_state, const DrawModes::DrawMode &_drawmode)
restores original texture (or no-texture)
void enter(GLState &_state, const DrawModes::DrawMode &_drawmode)
set texture
static void bindTexture(GLenum _target, GLuint _buffer)
replaces glBindTexture, supports locking
static GLuint texture_
handle for the texture into which characters from qfont_ are painted in updateFont() ...