Anasky

Heya,

I've been implementing VoxelFarm's C++ SDK for a while by now, and have it currently working with correct vertices, UV, and normals. I am however currently using my own textures and I'd like to switch to use the correct VF material for that given voxel. I'm fine with using the shaders as well, but my knowledge in OpenGL is incredibly limited... If anyone would be able to help me in the right direction, that would be really nice 😉

Thanks in advance!
Anasky


OpenGLLib::clsMaterial* l_Material[ 4 ];
l_Material[ 0 ] = OpenGL.LoadMaterial( "Box" );
l_Material[ 1 ] = OpenGL.LoadMaterial( "Grass" );
l_Material[ 2 ] = nullptr;
l_Material[ 3 ] = nullptr;

for (int medium = 0; medium < VoxelFarm::CCellData::MEDIUM_MAX; medium++)
{
if (l_Material[ medium ] != nullptr)
{
OpenGLLib::clsOpenGLDrawHelper:😋repareModelViewProjectionUniforms( l_Material[ medium ]->GetShader( ) );
l_Material[ medium ]->GetShader( )->Bind( );
for (size_t i = 0; i < l_Material[ medium ]->GetTextures( )->size( ); ++i)
{
glActiveTexture( (GLenum) ( GL_TEXTURE0 + i ) );
glBindTexture( l_Material[ medium ]->GetTextures( )->at( i )->GetTextureEnum( ), l_Material[ medium ]->GetTextures( )->at( i )->GetID( ) );
}

m_Scene.Draw( medium, l_Material[ medium ]->GetShader( ), m_ClipmapView );
}
}

0 0