1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-28 02:30:05 +00:00

Android GL fixes.

This commit is contained in:
jules 2014-02-24 20:29:13 +00:00
parent 56f7676601
commit fa2b42a742
2 changed files with 11 additions and 10 deletions

View file

@ -120,8 +120,7 @@ public:
void selectPreset (int preset)
{
const ShaderPreset& p = getPresets()[preset];
fragmentDocument.replaceAllContent (p.fragmentShader);
fragmentDocument.replaceAllContent (getPresets()[preset].fragmentShader);
startTimer (1);
}
@ -212,8 +211,8 @@ private:
" " JUCE_MEDIUMP " vec4 colour2 = vec4 (0.0, 0.8, 0.6, 1.0);\n"
" " JUCE_MEDIUMP " float distance = distance (pixelPos, vec2 (600.0, 500.0));\n"
"\n"
" " JUCE_MEDIUMP " const float innerRadius = 200.0;\n"
" " JUCE_MEDIUMP " const float outerRadius = 210.0;\n"
" " JUCE_MEDIUMP " float innerRadius = 200.0;\n"
" " JUCE_MEDIUMP " float outerRadius = 210.0;\n"
"\n"
" if (distance < innerRadius)\n"
" gl_FragColor = colour1;\n"

View file

@ -354,13 +354,15 @@ public:
" gl_Position = vec4 (scaledPos.x - 1.0, 1.0 - scaledPos.y, 0, 1.0);"
"}");
compiledOk = program.addFragmentShader (fragmentShader);
if (! program.addFragmentShader (fragmentShader))
lastError = program.getLastError();
program.link();
JUCE_CHECK_OPENGL_ERROR
}
OpenGLShaderProgram program;
bool compiledOk;
String lastError;
};
struct ShaderBase : public ShaderProgramHolder
@ -1786,7 +1788,9 @@ struct CustomProgram : public ReferenceCountedObject,
{
ReferenceCountedObjectPtr<CustomProgram> c (new CustomProgram (*sc, code));
if (c->compiledOk)
errorMessage = c->lastError;
if (errorMessage.isEmpty())
{
if (OpenGLContext* context = OpenGLContext::getCurrentContext())
{
@ -1794,8 +1798,6 @@ struct CustomProgram : public ReferenceCountedObject,
return c;
}
}
errorMessage = c->program.getLastError();
}
return nullptr;
@ -1807,7 +1809,7 @@ struct CustomProgram : public ReferenceCountedObject,
OpenGLGraphicsContextCustomShader::OpenGLGraphicsContextCustomShader (const String& fragmentShaderCode)
: code (String (JUCE_DECLARE_VARYING_COLOUR
JUCE_DECLARE_VARYING_PIXELPOS
"\nfloat pixelAlpha = frontColour.a;\n") + fragmentShaderCode),
"\n" JUCE_MEDIUMP " float pixelAlpha = frontColour.a;\n") + fragmentShaderCode),
hashName (String::toHexString (fragmentShaderCode.hashCode64()) + "_shader")
{
}