Fixed ScreenCoords::ToPixelData stack corruption

This commit is contained in:
2015-12-14 16:11:08 +01:00
parent fb2cd0c6ae
commit 798c73132e
+2 -3
View File
@@ -32,11 +32,10 @@ glm::vec3 ScreenCoords::ToWorldPos(glm::vec2 screenCoord, float depth, float scr
ScreenCoords::PixelData ScreenCoords::ToPixelData(float x, float y, FrameBuffer* PickDataBuffer, GLuint DepthBuffer) ScreenCoords::PixelData ScreenCoords::ToPixelData(float x, float y, FrameBuffer* PickDataBuffer, GLuint DepthBuffer)
{ {
PickDataBuffer->Bind(); PickDataBuffer->Bind();
unsigned char pdata[2]; unsigned char pdata[3];
glReadPixels(x, y, 1, 1, GL_RG, GL_UNSIGNED_BYTE, &pdata); glReadPixels(x, y, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, &pdata);
PickDataBuffer->Unbind(); PickDataBuffer->Unbind();
glBindFramebuffer(GL_FRAMEBUFFER, DepthBuffer); glBindFramebuffer(GL_FRAMEBUFFER, DepthBuffer);
float depthData; float depthData;
glReadPixels(x, y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depthData); glReadPixels(x, y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depthData);