OpenGLAppExample does not compile


Microsoft Visual C++ 2010, Win 7 32 bit.

I get these errors trying to compile this demo "out of the box"

1>  MainComponent.cpp
1>d:\dev\c++\juce\examples\openglappexample\source\maincomponent.cpp(52): warning C4305: 'initializing' : truncation from 'double' to 'float'
1>d:\dev\c++\juce\examples\openglappexample\source\maincomponent.cpp(71): warning C4305: 'argument' : truncation from 'double' to 'float'
1>d:\dev\c++\juce\examples\openglappexample\source\maincomponent.cpp(118): error C2059: syntax error : '{'
1>d:\dev\c++\juce\examples\openglappexample\source\maincomponent.cpp(118): error C2143: syntax error : missing ';' before '{'
1>d:\dev\c++\juce\examples\openglappexample\source\maincomponent.cpp(134): error C2143: syntax error : missing ';' before '}'
1>d:\dev\c++\juce\examples\openglappexample\source\maincomponent.cpp(136): error C2059: syntax error : '{'
1>d:\dev\c++\juce\examples\openglappexample\source\maincomponent.cpp(136): error C2143: syntax error : missing ';' before '{'
1>d:\dev\c++\juce\examples\openglappexample\source\maincomponent.cpp(149): error C2143: syntax error : missing ';' before '}'

in this initialization code (at the opening braces):

        vertexShader = {
                "attribute vec4 position;\n"
                "attribute vec4 sourceColour;\n"
                "attribute vec2 texureCoordIn;\n"
                "uniform mat4 projectionMatrix;\n"
                "uniform mat4 viewMatrix;\n"
                "varying vec4 destinationColour;\n"
                "varying vec2 textureCoordOut;\n"
                "void main()\n"
                "    destinationColour = sourceColour;\n"
                "    textureCoordOut = texureCoordIn;\n"
                "    gl_Position = projectionMatrix * viewMatrix * position;\n"
        fragmentShader = {


Damn, looks like nobody ever tried that on windows - have fixed it now, thanks!


Lol! Thanks Jules!

Is it a C++ construct that does get compiled in XCode?


Yes, probably because the braces are handled as the new C++11 initialiser list syntax.


Ah, I should have tried VS2013 then... I am not yet familiar enough with the 11 additions.