* use external textures mipmaps generation, draw NPoT textures correctly

This commit is contained in:
Garux 2018-06-10 01:27:49 +03:00
parent d6389acf21
commit f83dc2e891
2 changed files with 9 additions and 1 deletions

View File

@ -350,7 +350,7 @@ void renderString( const char *s, const GLuint& tex, const unsigned int colour[3
glTexSubImage2D( GL_TEXTURE_2D, 0, wid, 0, wid, hei, GL_BGRA, GL_UNSIGNED_BYTE, buf ); glTexSubImage2D( GL_TEXTURE_2D, 0, wid, 0, wid, hei, GL_BGRA, GL_UNSIGNED_BYTE, buf );
memset( buf, 0x00, 4 * hei * wid ); memset( buf, 0x00, 4 * hei * wid );
/* orange childSselected with shadow */ /* orange childSelected with shadow */
gray_to_texture( wid, hei, bitmap.buffer, buf, 255, 128, 0 ); gray_to_texture( wid, hei, bitmap.buffer, buf, 255, 128, 0 );
glTexSubImage2D( GL_TEXTURE_2D, 0, wid * 2, 0, wid, hei, GL_BGRA, GL_UNSIGNED_BYTE, buf ); glTexSubImage2D( GL_TEXTURE_2D, 0, wid * 2, 0, wid, hei, GL_BGRA, GL_UNSIGNED_BYTE, buf );

View File

@ -202,7 +202,14 @@ void LoadTextureRGBA( qtexture_t* q, unsigned char* pPixels, int nWidth, int nHe
SetTexParameters( g_texture_mode ); SetTexParameters( g_texture_mode );
SetTexAnisotropy( g_TextureAnisotropy ); SetTexAnisotropy( g_TextureAnisotropy );
#if 1
glTexParameteri( GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE );
glTexImage2D( GL_TEXTURE_2D, 0, g_texture_globals.texture_components, nWidth, nHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, pPixels );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, std::min( max_texture_quality - g_Textures_textureQuality.m_value, static_cast<int>( log2( static_cast<float>( std::max( nWidth, nHeight ) ) ) ) ) );
glBindTexture( GL_TEXTURE_2D, 0 );
#else
int gl_width = 1; int gl_width = 1;
while ( gl_width < nWidth ) while ( gl_width < nWidth )
gl_width <<= 1; gl_width <<= 1;
@ -258,6 +265,7 @@ void LoadTextureRGBA( qtexture_t* q, unsigned char* pPixels, int nWidth, int nHe
if ( resampled ) { if ( resampled ) {
free( outpixels ); free( outpixels );
} }
#endif
} }
#if 0 #if 0