1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-04 03:40:07 +00:00

Fix black teapot issue

This commit is contained in:
hogliux 2016-02-03 13:19:01 +00:00
parent bd9d67fd30
commit fa1ad90386

View file

@ -589,7 +589,7 @@ struct OpenGLDemoClasses
OpenGLDemo()
: doBackgroundDrawing (false),
scale (0.5f), rotationSpeed (0.0f), rotation (0.0f),
textureToUse (nullptr)
textureToUse (nullptr), lastTexture (nullptr)
{
if (MainAppWindow* mw = MainAppWindow::getMainAppWindow())
mw->setRenderingEngine (0);
@ -624,6 +624,9 @@ struct OpenGLDemoClasses
// When the context is about to close, you must use this callback to delete
// any GPU resources while the context is still current.
freeAllContextObjects();
if (lastTexture != nullptr)
setTexture (lastTexture);
}
void freeAllContextObjects()
@ -719,7 +722,7 @@ struct OpenGLDemoClasses
void setTexture (DemoTexture* t)
{
textureToUse = t;
lastTexture = textureToUse = t;
}
void setShaderProgram (const String& vertexShader, const String& fragmentShader)
@ -789,7 +792,7 @@ struct OpenGLDemoClasses
ScopedPointer<Uniforms> uniforms;
OpenGLTexture texture;
DemoTexture* textureToUse;
DemoTexture* textureToUse, *lastTexture;
String newVertexShader, newFragmentShader;