Problem using OpenGL


#1

Hello,

I’m currently working on a project using the Juce framework. Everything works great. Except that I have some problems to use the OpenGL. 

 

Let me explains first what I do. 

So I have an openGLContext set on a component. (To be sure that it would works, I took the OpenGLDemo file existing in JuceDemo, and I delete everything and keep the basis). I was able to do what I wanted to do with OpenGL. What I draw is just simple colored polygon, nothing asking a high level in OpenGL. Here is my code

    glBindTexture(GL_TEXTURE_2D, texture->getTextureID());

    glBegin(GL_POLYGON);

    for(unsigned int i = 0; i < m_ vertices.size(); i++)

    {

         glVertex3f(x,y,z);

    }

    glEnd();

    glBindTexture(GL_TEXTURE_2D, 0);

 

 

It works well on desktop OS, but it fails on mobile OS, but I figured out it was normal. And this is where my problem began.

 

After a lot of research (mainly in this forum), I find out, that it should have worked with OpenGL ES1.x. But as the openGLContext is set for OpenGLES 2.x, it is normal that my code doesn’t compile for mobile devices.

I also find out at the same time that the original JuceOpenGLDemo doesn’t work on iOS (the cube drawn in OpenGL is not displayed). 

I did some extra research. I find out that Juce don’t support the OpenGL on iOS. I read several discussion, where people are testing some stuff to make it work, but unfortunately, there is no return about their own solution. 

 

I also try on my own to draw just a polygon, inspiring from a tutorial on OpenGLES as I’m not an export in OpenGL and OpenGLES. It didn’t’ work, but I don’t know if the problem is me, or Juce. So  my problem is that I have problem to know if I can use “pure” openGLES methods, or if I have to do something (like setting up the view using some Juce methods).

 

I just need to draw polygons in the 3D space, without any complicated effects. I just fill them with a uniform color or a simple texture.

 

 

I'm currently stuck with these openGL problems :( 

 

So, I'm trying to find some advices, or a little help or anything that could help me to resolve the problem. 

 

 

Thanks in advance for you help !

 

 

 

 

 

 

 


#2

Juce supports OpenGL on iOS.

 

JuceDemo doesn't currently have the code to draw the same stuff in every openGL ES flavor, but it does give you a valid context. So what you actually have is probably just an OpenGL ES problem.

 

Start simple - very simple: say sending all vertices every frame for a color triangle, then ramp up.

 

Bruce

 

 


#3

We're just in the final stages of doing a new juce demo, which will include some 3D stuff in GL ES, and also a live shader editor, etc... Hopefully out soon!


#4

Thank you both for your response.

 

That means the problem was me. So with the context created by Juce, I can use the regular OpenGL es function. I will take a look at that.

The coming new version of Juce Demo sounds great!! 


#5

That's great news Jules! thanks