| 87 | |
| 88 | |
| 89 | void GeometryObject::ApplyTexture( const uint8_t * data, int width, int height, int channels ) |
| 90 | { |
| 91 | if( !m_unTexture ) glGenTextures( 1, &m_unTexture ); |
| 92 | glBindTexture( GL_TEXTURE_2D, m_unTexture ); |
| 93 | |
| 94 | int channelmap[] = { 0, GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_RGB, GL_RGBA }; |
| 95 | glTexImage2D( GL_TEXTURE_2D, 0, channelmap[channels], width, height, |
| 96 | 0, channelmap[channels], GL_UNSIGNED_BYTE, data ); |
| 97 | |
| 98 | m_iTextureWidth = width; |
| 99 | m_iTextureHeight = height; |
| 100 | |
| 101 | glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ); |
| 102 | glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); |
| 103 | glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); |
| 104 | glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); |
| 105 | |
| 106 | //Best not to be default. |
| 107 | //GLfloat fLargest; |
| 108 | //glGetFloatv( GL_MAX_TEXTURE_MAX_ANISOTROPY, &fLargest ); |
| 109 | //glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY, fLargest ); |
| 110 | |
| 111 | glBindTexture( GL_TEXTURE_2D, 0 ); |
| 112 | |
| 113 | } |
| 114 | |
| 115 | void GeometryObject::Render( int index ) |
| 116 | { |
nothing calls this directly
no outgoing calls
no test coverage detected