I’ve update the code, so now we can open openglWithJuce.xcodeproj, compile and run !
But unfortunately , there is some bug with the code or with my graphic card,
when i call glBindVertexArray, it throws GL_INVALID_OPERATION with error code 1282.
I assume it‘s my graphic card bug.
Anyone want help to test, thanks!
Thank you for the code , and I can make it running after add the code openGLContext.setOpenGLVersionRequired(juce::OpenGLContext::openGL3_2);
but behave differently from win version as follow image, I’ll look into it.
I digged a bit and I found that this is a problem with translating shaders from version 2 to version 3.
I will create pull request and there describe what I found in more details.
@ mateusz
Thank you very much , looking forward it , and I will look into it too!
update:
I think it’s tricky.
because shader is compiled successfully and without any error .
And the output info shows that Current glsl version is 4.10 and should support in and out keyword.
I also checked the glversion in initialise function by AlertWindow::showMessageBox(AlertWindow::AlertIconType::InfoIcon, "glversion", (char*)glGetString(GL_VERSION));
also is 4.10.
I also tried modify juce code #define JUCE_GLSL_VERSION "#version 150"
to #define JUCE_GLSL_VERSION "#version 410"
then shader can compile and link without any error , but the demo cube still can’t show .
Anyway your pull request works . I’ll merge and Now I can move forward on my mac .
Thanks!
update:
I finally figure out what’s the fundamental problem. It’s basically how @ mateusz does.
Let’s say tutorial 3. we just change the vertex shader from
layout (location=0) in vec3 aPos;
layout (location=1) in vec3 aColor;
layout (location=2) in vec2 aTexCoord;
Which is how original tutorial write. It’s my bad.(originally I want to support old graphic card, but it seems not work! so I want to use glsl version 330 instead)
then We need to specify the glsl version we want to use in shader .
like #version 330 core
I think juce team should give us a chance to specify what’s GLSL version we want to use , then problem solved!
I made a JUCE OpenGL setup tutorial for rendering basic interactive 3D objects including a triangle, pyramid, and cube. It’s a code-along tutorial video with available source code and some utility classes.