mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 15:09:19 +02:00
texture binding fix
This commit is contained in:
10
Ground.cpp
10
Ground.cpp
@@ -339,9 +339,9 @@ void TGroundNode::RenderVBO() { // renderowanie obiektu z VBO - faza nieprzezroc
|
|||||||
b = floor( Diffuse[ 2 ] * Global::DayLight.ambient[ 2 ] );
|
b = floor( Diffuse[ 2 ] * Global::DayLight.ambient[ 2 ] );
|
||||||
#endif
|
#endif
|
||||||
glColor4ub( r, g, b, linealpha ); // przezroczystosc dalekiej linii
|
glColor4ub( r, g, b, linealpha ); // przezroczystosc dalekiej linii
|
||||||
// glDisable(GL_LIGHTING); //nie powinny świecić
|
GfxRenderer.Bind( 0 );
|
||||||
|
|
||||||
glDrawArrays( iType, iVboPtr, iNumPts ); // rysowanie linii
|
glDrawArrays( iType, iVboPtr, iNumPts ); // rysowanie linii
|
||||||
// glEnable(GL_LIGHTING);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// GL_TRIANGLE etc
|
// GL_TRIANGLE etc
|
||||||
@@ -408,6 +408,7 @@ void TGroundNode::RenderAlphaVBO()
|
|||||||
float b = Diffuse[ 2 ] * Global::DayLight.ambient[ 2 ];
|
float b = Diffuse[ 2 ] * Global::DayLight.ambient[ 2 ];
|
||||||
#endif
|
#endif
|
||||||
glColor4ub( r, g, b, linealpha ); // przezroczystosc dalekiej linii
|
glColor4ub( r, g, b, linealpha ); // przezroczystosc dalekiej linii
|
||||||
|
GfxRenderer.Bind( 0 );
|
||||||
|
|
||||||
glDrawArrays( iType, iVboPtr, iNumPts ); // rysowanie linii
|
glDrawArrays( iType, iVboPtr, iNumPts ); // rysowanie linii
|
||||||
}
|
}
|
||||||
@@ -447,9 +448,6 @@ void TGroundNode::Compile(bool many)
|
|||||||
{
|
{
|
||||||
#ifdef USE_VERTEX_ARRAYS
|
#ifdef USE_VERTEX_ARRAYS
|
||||||
glVertexPointer(3, GL_DOUBLE, sizeof(vector3), &Points[0].x);
|
glVertexPointer(3, GL_DOUBLE, sizeof(vector3), &Points[0].x);
|
||||||
#endif
|
|
||||||
GfxRenderer.Bind(0);
|
|
||||||
#ifdef USE_VERTEX_ARRAYS
|
|
||||||
glDrawArrays(iType, 0, iNumPts);
|
glDrawArrays(iType, 0, iNumPts);
|
||||||
#else
|
#else
|
||||||
glBegin(iType);
|
glBegin(iType);
|
||||||
@@ -608,6 +606,7 @@ void TGroundNode::RenderDL()
|
|||||||
b = floor( Diffuse[ 2 ] * Global::DayLight.ambient[ 2 ] );
|
b = floor( Diffuse[ 2 ] * Global::DayLight.ambient[ 2 ] );
|
||||||
#endif
|
#endif
|
||||||
glColor4ub( r, g, b, linealpha ); // przezroczystosc dalekiej linii
|
glColor4ub( r, g, b, linealpha ); // przezroczystosc dalekiej linii
|
||||||
|
GfxRenderer.Bind( 0 );
|
||||||
|
|
||||||
glCallList( DisplayListID );
|
glCallList( DisplayListID );
|
||||||
}
|
}
|
||||||
@@ -691,6 +690,7 @@ void TGroundNode::RenderAlphaDL()
|
|||||||
float b = Diffuse[ 2 ] * Global::DayLight.ambient[ 2 ];
|
float b = Diffuse[ 2 ] * Global::DayLight.ambient[ 2 ];
|
||||||
#endif
|
#endif
|
||||||
glColor4ub( r, g, b, linealpha ); // przezroczystosc dalekiej linii
|
glColor4ub( r, g, b, linealpha ); // przezroczystosc dalekiej linii
|
||||||
|
GfxRenderer.Bind( 0 );
|
||||||
|
|
||||||
glCallList( DisplayListID );
|
glCallList( DisplayListID );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,6 +66,8 @@ opengl_texture::load() {
|
|||||||
fail:
|
fail:
|
||||||
data_state = resource_state::failed;
|
data_state = resource_state::failed;
|
||||||
ErrorLog( "Failed to load texture \"" + name + "\"" );
|
ErrorLog( "Failed to load texture \"" + name + "\"" );
|
||||||
|
// NOTE: temporary workaround for texture assignment errors
|
||||||
|
id = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,6 +254,7 @@ opengl_texture::load_DDS() {
|
|||||||
data_width /= 2;
|
data_width /= 2;
|
||||||
data_height /= 2;
|
data_height /= 2;
|
||||||
--data_mapcount;
|
--data_mapcount;
|
||||||
|
WriteLog( "Texture size exceeds specified limits, skipping mipmap level" );
|
||||||
};
|
};
|
||||||
|
|
||||||
if( data_mapcount <= 0 ) {
|
if( data_mapcount <= 0 ) {
|
||||||
@@ -676,6 +679,7 @@ opengl_texture::downsize( GLuint const Format ) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WriteLog( "Texture size exceeds specified limits, downsampling data" );
|
||||||
switch( Format ) {
|
switch( Format ) {
|
||||||
|
|
||||||
case GL_RGB: { downsample< glm::tvec3<std::uint8_t> >( data_width, data_height, data.data() ); break; }
|
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
|
// TODO: do binding in texture object, add support for other types
|
||||||
if( Id != 0 ) {
|
if( Id != 0 ) {
|
||||||
#ifndef EU07_DEFERRED_TEXTURE_UPLOAD
|
#ifndef EU07_DEFERRED_TEXTURE_UPLOAD
|
||||||
::glBindTexture( GL_TEXTURE_2D, Id );
|
// NOTE: we could bind dedicated 'error' texture here if the id isn't valid
|
||||||
m_activetexture = 0;
|
::glBindTexture( GL_TEXTURE_2D, Texture(Id).id );
|
||||||
|
m_activetexture = Texture(Id).id;
|
||||||
#else
|
#else
|
||||||
if( Texture( Id ).bind() == resource_state::good ) {
|
if( Texture( Id ).bind() == resource_state::good ) {
|
||||||
m_activetexture = Id;
|
m_activetexture = Id;
|
||||||
|
|||||||
Reference in New Issue
Block a user