Attempt to fix texture rendering on OpenGL 1.1 cards

This commit is contained in:
Enrico Turri 2018-06-21 13:03:53 +02:00
parent 4fcbb73141
commit b139f38784
3 changed files with 28 additions and 5 deletions

View file

@ -396,6 +396,9 @@ void GLVolume::render_using_layer_height() const
GLsizei half_w = w / 2;
GLsizei half_h = h / 2;
//#######################################################################################################################
::glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
//#######################################################################################################################
glBindTexture(GL_TEXTURE_2D, layer_height_texture_data.texture_id);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
glTexImage2D(GL_TEXTURE_2D, 1, GL_RGBA8, half_w, half_h, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
@ -1582,6 +1585,9 @@ unsigned int _3DScene::TextureBase::finalize()
{
if (!m_data.empty()) {
// sends buffer to gpu
//#######################################################################################################################
::glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
//#######################################################################################################################
::glGenTextures(1, &m_tex_id);
::glBindTexture(GL_TEXTURE_2D, m_tex_id);
::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, (GLsizei)m_tex_width, (GLsizei)m_tex_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const GLvoid*)m_data.data());