texture binding fix

This commit is contained in:
tmj-fstate
2017-03-26 20:20:29 +02:00
parent fbba5589f7
commit 2ec6cad7cb
2 changed files with 12 additions and 7 deletions

View File

@@ -339,9 +339,9 @@ void TGroundNode::RenderVBO() { // renderowanie obiektu z VBO - faza nieprzezroc
b = floor( Diffuse[ 2 ] * Global::DayLight.ambient[ 2 ] );
#endif
glColor4ub( r, g, b, linealpha ); // przezroczystosc dalekiej linii
// glDisable(GL_LIGHTING); //nie powinny świecić
GfxRenderer.Bind( 0 );
glDrawArrays( iType, iVboPtr, iNumPts ); // rysowanie linii
// glEnable(GL_LIGHTING);
}
}
// GL_TRIANGLE etc
@@ -408,6 +408,7 @@ void TGroundNode::RenderAlphaVBO()
float b = Diffuse[ 2 ] * Global::DayLight.ambient[ 2 ];
#endif
glColor4ub( r, g, b, linealpha ); // przezroczystosc dalekiej linii
GfxRenderer.Bind( 0 );
glDrawArrays( iType, iVboPtr, iNumPts ); // rysowanie linii
}
@@ -447,9 +448,6 @@ void TGroundNode::Compile(bool many)
{
#ifdef USE_VERTEX_ARRAYS
glVertexPointer(3, GL_DOUBLE, sizeof(vector3), &Points[0].x);
#endif
GfxRenderer.Bind(0);
#ifdef USE_VERTEX_ARRAYS
glDrawArrays(iType, 0, iNumPts);
#else
glBegin(iType);
@@ -608,6 +606,7 @@ void TGroundNode::RenderDL()
b = floor( Diffuse[ 2 ] * Global::DayLight.ambient[ 2 ] );
#endif
glColor4ub( r, g, b, linealpha ); // przezroczystosc dalekiej linii
GfxRenderer.Bind( 0 );
glCallList( DisplayListID );
}
@@ -691,6 +690,7 @@ void TGroundNode::RenderAlphaDL()
float b = Diffuse[ 2 ] * Global::DayLight.ambient[ 2 ];
#endif
glColor4ub( r, g, b, linealpha ); // przezroczystosc dalekiej linii
GfxRenderer.Bind( 0 );
glCallList( DisplayListID );
}

View File

@@ -66,6 +66,8 @@ opengl_texture::load() {
fail:
data_state = resource_state::failed;
ErrorLog( "Failed to load texture \"" + name + "\"" );
// NOTE: temporary workaround for texture assignment errors
id = 0;
return;
}
@@ -252,6 +254,7 @@ opengl_texture::load_DDS() {
data_width /= 2;
data_height /= 2;
--data_mapcount;
WriteLog( "Texture size exceeds specified limits, skipping mipmap level" );
};
if( data_mapcount <= 0 ) {
@@ -676,6 +679,7 @@ opengl_texture::downsize( GLuint const Format ) {
break;
}
WriteLog( "Texture size exceeds specified limits, downsampling data" );
switch( Format ) {
case GL_RGB: { downsample< glm::tvec3<std::uint8_t> >( data_width, data_height, data.data() ); break; }
@@ -817,8 +821,9 @@ texture_manager::Bind( texture_manager::size_type const Id ) {
// TODO: do binding in texture object, add support for other types
if( Id != 0 ) {
#ifndef EU07_DEFERRED_TEXTURE_UPLOAD
::glBindTexture( GL_TEXTURE_2D, Id );
m_activetexture = 0;
// NOTE: we could bind dedicated 'error' texture here if the id isn't valid
::glBindTexture( GL_TEXTURE_2D, Texture(Id).id );
m_activetexture = Texture(Id).id;
#else
if( Texture( Id ).bind() == resource_state::good ) {
m_activetexture = Id;