GPU::Texture2D GPU::Texture2D::Clone() const { glPushAttrib( GL_TEXTURE_BIT ); GPU::Texture2D newTex; newTex.Create(); newTex.m_Width = Width(); newTex.m_Height = Height(); if( m_Id ) { GPU::FrameBuffer fbuffer( Width(), Height() ); fbuffer.Attach( GL_COLOR_ATTACHMENT0_EXT, this ); fbuffer.Bind(); newTex.Bind(); glCopyTexImage2D( GL_TEXTURE_2D, 0, InternalFormat(), 0, 0, Width(), Height(), 0 ); newTex.Unbind(); fbuffer.Unbind(); } glPopAttrib(); return newTex; }
void TextureData3D :: Upload ( GLenum target ) { glTexImage3D ( target /* the target texture */, 0 /* the level-of-detail number */, InternalFormat ( ) /* the number of color components */, Width ( ) /* the width of the texture with border */, Height ( ) /* the height of the texture with border */, Depth ( ) /* the depth of the texture with border */, 0 /* the width of the border */, PixelFormat ( ) /* the format of the pixel data */, Type ( ) /* the data type of the pixel data */, fPixels /* a pointer to the image data */ ); }