Commit 1fa15a15 authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

Fixed crash when downloading an OpenGL texture to a local buffer.

This was due to a missing/wrong GL_PACK_ALIGNMENT setting.

closes #568
parent 58198de5
...@@ -773,6 +773,7 @@ void Texture::downloadTexture() { ...@@ -773,6 +773,7 @@ void Texture::downloadTexture() {
if (pixels_ == 0) if (pixels_ == 0)
alloc(); alloc();
glPixelStorei(GL_PACK_ALIGNMENT, 1);
glGetTexImage(type_, 0, format_, dataType_, pixels_); glGetTexImage(type_, 0, format_, dataType_, pixels_);
} }
...@@ -782,6 +783,7 @@ GLubyte* Texture::downloadTextureToBuffer() const { ...@@ -782,6 +783,7 @@ GLubyte* Texture::downloadTextureToBuffer() const {
int arraySize = hmul(dimensions_) * bpp_; int arraySize = hmul(dimensions_) * bpp_;
GLubyte* pixels = new GLubyte[arraySize]; GLubyte* pixels = new GLubyte[arraySize];
glPixelStorei(GL_PACK_ALIGNMENT, 1);
glGetTexImage(type_, 0, format_, dataType_, pixels); glGetTexImage(type_, 0, format_, dataType_, pixels);
return pixels; return pixels;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment