| @@ -67,11 +67,11 @@ ProjectExporter* ProjectExporter::createNewExporter (Project& project, const int | |||||
| { | { | ||||
| case 0: exp = new XCodeProjectExporter (project, ValueTree (XCodeProjectExporter ::getValueTreeTypeName (false)), false); break; | case 0: exp = new XCodeProjectExporter (project, ValueTree (XCodeProjectExporter ::getValueTreeTypeName (false)), false); break; | ||||
| case 1: exp = new XCodeProjectExporter (project, ValueTree (XCodeProjectExporter ::getValueTreeTypeName (true)), true); break; | case 1: exp = new XCodeProjectExporter (project, ValueTree (XCodeProjectExporter ::getValueTreeTypeName (true)), true); break; | ||||
| case 3: exp = new MSVCProjectExporterVC2005 (project, ValueTree (MSVCProjectExporterVC2005::getValueTreeTypeName())); break; | |||||
| case 4: exp = new MSVCProjectExporterVC2008 (project, ValueTree (MSVCProjectExporterVC2008::getValueTreeTypeName())); break; | |||||
| case 5: exp = new MSVCProjectExporterVC2010 (project, ValueTree (MSVCProjectExporterVC2010::getValueTreeTypeName())); break; | |||||
| case 6: exp = new MakefileProjectExporter (project, ValueTree (MakefileProjectExporter ::getValueTreeTypeName())); break; | |||||
| case 7: exp = new AndroidProjectExporter (project, ValueTree (AndroidProjectExporter ::getValueTreeTypeName())); break; | |||||
| case 2: exp = new MSVCProjectExporterVC2005 (project, ValueTree (MSVCProjectExporterVC2005::getValueTreeTypeName())); break; | |||||
| case 3: exp = new MSVCProjectExporterVC2008 (project, ValueTree (MSVCProjectExporterVC2008::getValueTreeTypeName())); break; | |||||
| case 4: exp = new MSVCProjectExporterVC2010 (project, ValueTree (MSVCProjectExporterVC2010::getValueTreeTypeName())); break; | |||||
| case 5: exp = new MakefileProjectExporter (project, ValueTree (MakefileProjectExporter ::getValueTreeTypeName())); break; | |||||
| case 6: exp = new AndroidProjectExporter (project, ValueTree (AndroidProjectExporter ::getValueTreeTypeName())); break; | |||||
| default: jassertfalse; return 0; | default: jassertfalse; return 0; | ||||
| } | } | ||||
| @@ -416,7 +416,7 @@ private: | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| port = 0; // indicates the default port | |||||
| port = 80; | |||||
| if (nextSlash >= 0) | if (nextSlash >= 0) | ||||
| host = url.substring (7, nextSlash); | host = url.substring (7, nextSlash); | ||||
| @@ -65,6 +65,7 @@ | |||||
| USE_FUNCTION (glUseProgram, void, (GLuint p1), (p1))\ | USE_FUNCTION (glUseProgram, void, (GLuint p1), (p1))\ | ||||
| USE_FUNCTION (glGetShaderiv, void, (GLuint p1, GLenum p2, GLint* p3), (p1, p2, p3))\ | USE_FUNCTION (glGetShaderiv, void, (GLuint p1, GLenum p2, GLint* p3), (p1, p2, p3))\ | ||||
| USE_FUNCTION (glGetShaderInfoLog, void, (GLuint p1, GLsizei p2, GLsizei* p3, GLchar* p4), (p1, p2, p3, p4))\ | USE_FUNCTION (glGetShaderInfoLog, void, (GLuint p1, GLsizei p2, GLsizei* p3, GLchar* p4), (p1, p2, p3, p4))\ | ||||
| USE_FUNCTION (glGetProgramInfoLog, void, (GLuint p1, GLsizei p2, GLsizei* p3, GLchar* p4), (p1, p2, p3, p4))\ | |||||
| USE_FUNCTION (glGetProgramiv, void, (GLuint p1, GLenum p2, GLint* p3), (p1, p2, p3))\ | USE_FUNCTION (glGetProgramiv, void, (GLuint p1, GLenum p2, GLint* p3), (p1, p2, p3))\ | ||||
| USE_FUNCTION (glGetUniformLocation, GLint, (GLuint p1, const GLchar* p2), (p1, p2))\ | USE_FUNCTION (glGetUniformLocation, GLint, (GLuint p1, const GLchar* p2), (p1, p2))\ | ||||
| USE_FUNCTION (glGetAttribLocation, GLint, (GLuint p1, const GLchar* p2), (p1, p2))\ | USE_FUNCTION (glGetAttribLocation, GLint, (GLuint p1, const GLchar* p2), (p1, p2))\ | ||||
| @@ -50,14 +50,13 @@ double OpenGLShaderProgram::getLanguageVersion() | |||||
| #endif | #endif | ||||
| } | } | ||||
| void OpenGLShaderProgram::addShader (const char* const code, GLenum type) | |||||
| bool OpenGLShaderProgram::addShader (const char* const code, GLenum type) | |||||
| { | { | ||||
| GLuint shaderID = context.extensions.glCreateShader (type); | GLuint shaderID = context.extensions.glCreateShader (type); | ||||
| context.extensions.glShaderSource (shaderID, 1, (const GLchar**) &code, nullptr); | context.extensions.glShaderSource (shaderID, 1, (const GLchar**) &code, nullptr); | ||||
| context.extensions.glCompileShader (shaderID); | context.extensions.glCompileShader (shaderID); | ||||
| #if JUCE_DEBUG | |||||
| GLint status = 0; | |||||
| GLint status = GL_FALSE; | |||||
| context.extensions.glGetShaderiv (shaderID, GL_COMPILE_STATUS, &status); | context.extensions.glGetShaderiv (shaderID, GL_COMPILE_STATUS, &status); | ||||
| if (status == GL_FALSE) | if (status == GL_FALSE) | ||||
| @@ -65,24 +64,42 @@ void OpenGLShaderProgram::addShader (const char* const code, GLenum type) | |||||
| GLchar infoLog [16384]; | GLchar infoLog [16384]; | ||||
| GLsizei infologLength = 0; | GLsizei infologLength = 0; | ||||
| context.extensions.glGetShaderInfoLog (shaderID, sizeof (infoLog), &infologLength, infoLog); | context.extensions.glGetShaderInfoLog (shaderID, sizeof (infoLog), &infologLength, infoLog); | ||||
| DBG (String (infoLog, infologLength)); | |||||
| errorLog = String (infoLog, infologLength); | |||||
| #if JUCE_DEBUG | |||||
| DBG (errorLog); | |||||
| jassertfalse; | jassertfalse; | ||||
| #endif | |||||
| return false; | |||||
| } | } | ||||
| #endif | |||||
| context.extensions.glAttachShader (programID, shaderID); | context.extensions.glAttachShader (programID, shaderID); | ||||
| context.extensions.glDeleteShader (shaderID); | context.extensions.glDeleteShader (shaderID); | ||||
| return true; | |||||
| } | } | ||||
| void OpenGLShaderProgram::link() noexcept | |||||
| bool OpenGLShaderProgram::link() noexcept | |||||
| { | { | ||||
| context.extensions.glLinkProgram (programID); | context.extensions.glLinkProgram (programID); | ||||
| #if JUCE_DEBUG | |||||
| GLint status = 0; | |||||
| GLint status = GL_FALSE; | |||||
| context.extensions.glGetProgramiv (programID, GL_LINK_STATUS, &status); | context.extensions.glGetProgramiv (programID, GL_LINK_STATUS, &status); | ||||
| jassert (status != GL_FALSE); | |||||
| #endif | |||||
| if (status == GL_FALSE) | |||||
| { | |||||
| GLchar infoLog [16384]; | |||||
| GLsizei infologLength = 0; | |||||
| context.extensions.glGetProgramInfoLog (programID, sizeof (infoLog), &infologLength, infoLog); | |||||
| errorLog = String (infoLog, infologLength); | |||||
| #if JUCE_DEBUG | |||||
| DBG (errorLog); | |||||
| jassertfalse; | |||||
| #endif | |||||
| } | |||||
| return status != GL_FALSE; | |||||
| } | } | ||||
| void OpenGLShaderProgram::use() const noexcept | void OpenGLShaderProgram::use() const noexcept | ||||
| @@ -56,14 +56,22 @@ public: | |||||
| fails to compile correctly. | fails to compile correctly. | ||||
| The shaderType parameter could be GL_VERTEX_SHADER, GL_FRAGMENT_SHADER, etc. | The shaderType parameter could be GL_VERTEX_SHADER, GL_FRAGMENT_SHADER, etc. | ||||
| @returns true if the shader compiled successfully. If not, you can call | |||||
| getLastError() to find out what happened. | |||||
| */ | */ | ||||
| void addShader (const char* const shaderSourceCode, GLenum shaderType); | |||||
| bool addShader (const char* const shaderSourceCode, GLenum shaderType); | |||||
| /** Links all the compiled shaders into a usable program. | /** Links all the compiled shaders into a usable program. | ||||
| If your app is built in debug mode, this method will assert if the program | If your app is built in debug mode, this method will assert if the program | ||||
| fails to link correctly. | fails to link correctly. | ||||
| @returns true if the program linked successfully. If not, you can call | |||||
| getLastError() to find out what happened. | |||||
| */ | */ | ||||
| void link() noexcept; | |||||
| bool link() noexcept; | |||||
| /** Get the output for the last shader compilation or link that failed. */ | |||||
| const String& getLastError() const noexcept { return errorLog; } | |||||
| /** Selects this program into the current context. */ | /** Selects this program into the current context. */ | ||||
| void use() const noexcept; | void use() const noexcept; | ||||
| @@ -132,6 +140,7 @@ public: | |||||
| private: | private: | ||||
| const OpenGLContext& context; | const OpenGLContext& context; | ||||
| String errorLog; | |||||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OpenGLShaderProgram); | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OpenGLShaderProgram); | ||||
| }; | }; | ||||