Code: Select all
bool COpenGLSLMaterialRenderer::setCubeMapSamplerFaces(const c8* name, ITexture** faces) {
#if defined(GL_VERSION_2_0)||defined(GL_ARB_shader_objects)
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
for(int i = 0; i < 6; ++i)
{
ITexture* tex = faces[i];
glTexImage2D(
GL_TEXTURE_CUBE_MAP_POSITIVE_X + i,
0, GL_RGB, tex->getSize().Width, tex->getSize().Height, 0, GL_RGB, GL_UNSIGNED_BYTE, tex->lock()
);
tex->unlock();
}
return true;
#else
return false;
#endif
}
Code: Select all
services->setCubeMapSamplerFaces("cube", faces); // faces has been set in another function (non-override) of the callback and they're render target's textures
Code: Select all
GL_INVALID_VALUE
Could not bind Texture