iOS OpenGL Blank screen (+ how to make it transparent ?)

I’m trying to draw simple opengl line or triangle (no matter) and when I run this on mac os x, it works. But not on iOSl. I see just blue screen without triangle or any line.

Here is my code below.

Can someone tell what is wrong with this code? I use example from JUCE > OpenGL Application

Second issue that the color array seems not to be working, because lines has a white color.

void MainComponent::render()
GLfloat vertices
-1.0f, -1.0f, 0.0f,
0.0f, 1.0f, 0.0f,
1.0f, -1.0f, 0.0f

uint8_t colors
25, 80, 0, 255,
25, 80, 190, 255,
25, 180, 0, 255

openGLContext.extensions.glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, vertices);
openGLContext.extensions.glVertexAttribPointer(2, 4, GL_UNSIGNED_BYTE, GL_TRUE, 0, colors);

glDrawArrays(GL_LINE_STRIP, 0, 3);

openGL on iOS is (a) very problematic from within JUCE itself, and this is well-documented, and (b) deprecated by Apple. So while I don’t know what is happening exactly with your code, I will say that it is something that is best avoided.

(Side note: I’m not even sure you can do fixed pipeline on iOS at all. I’ve never tried it, personally. Shaders work fine, though, for values of “fine” that equal “really fucking slow, and weak as shit.”)

1 Like

Thank you for the response.

Issue #1 Resolved The strange thing that this code worked well in non-Juce project. I’m just rewriting my swift/c++ project to the Juce framework. I can’t use Metal in this case, because Metal is not supported in AUV3 (and this is damn weird from Apple)

Anyway seems I solved this issue by using a shaders. So now I see triangle. BUT… I can’t make my background to be transparent. It just always black even on mac osx or ios. Even if I use empty component.

Issue#2 How can I make my component to be transparent? Has anyone come across this? If this can’t be done. Then I seems can’t use Juce framework.

The code below doesn’t help an at all :frowning: