Transitioning iOS to ES2.0

I’ve been poking around a bit in the ES2Renderer included in the iOS release just to get an idea of what needs to be done to transition towards OpenGL ES 2.0 on iOS devices. If we transition completely, this means we’d have simple shading possibilities, like ofShader in the ‘regular’ OF release.
Is anybody currently working on something like this? If so, I’d like to help out where I can. I am by no means an expert on OpenGL but I’m motivated to learn and I’d love to see this functionality.

Please correct me if I’m wrong, but I think there is a couple of things that need to be done.

  • Setup context, default framebuffer, render buffer, etc. This is already included in the current ES2Renderer.
  • Rewrite ofGLRenderer. Fixed pipeline is gone in ES2.0 so GL_VERTEX_ARRAY, GL_NORMAL_ARRAY, GL_COLOR_ARRAY etc all got to go and make room for glVertexAttribPointer in combination with VBO’s.
  • Adapt ofShader? I haven’t looked at this but I can imagine some incompatibility.

If we transition, it would also mean that there will be no output at all if no shaders are present, so maybe it’s a good idea to include a basic default shader.

I’d love to hear your thoughts on this.
Daan

Hi Daan

there’s actually a working version of OF done by andreas:

https://github.com/andreasmuller/openFrameworks/tree/develop-opengles2

that’s using gles2-bc, a library that gives most of the missing openGL ES1 functionality on top of a default shader + some default variables that you can use if you change that shader with something else.

i think the main work that needs to be done is to take some decision on the architecture and if we want to use gles2-bc or make something custom for OF which will be actually a lot of work.

also if you want to contribute in the development is a good idea to join the development mailing list where most of this discussions happen

Hi Arturo,

great, I was starting to think nobody reads this stuff :wink: I will look into the pros and cons of gles2-bc. How can I subscribe to the mailing list you mentioned?

Daan

you can do it here:

http://dev.openframeworks.cc/listinfo.cgi/of-dev-openframeworks.cc

I’m trying to use this fork but i have an error when i simply read a video.

The code :

  
  
void testApp::setup()  
{  
  ofSetFrameRate(30);  
  ofBackground(225, 225, 225);      
  _backgroundVideoPlayer.loadMovie("hands.m4v");  
  _backgroundVideoPlayer.play();  
}  
  
void testApp::update()  
{	  
  _backgroundVideoPlayer.idleMovie();  
}  
  
void testApp::draw()  
{  
  _backgroundVideoPlayer.draw(0, 0, 300, 300);  
}  
  

I get this error (endless displayed in console) :

  
  
** /Users/og/Documents/WORK/test/andreasmuller-openFrameworks-50a3b2b/apps/iPhoneAddonsExamples/GLES2Test/../../../addons/ofxGLES2Renderer/libs/gles2-bc/src/OpenGLES/OpenGLES20/OpenGLES20Context.cpp:648  
GL ERROR: 1282 GL_INVALID_OPERATION, operation illegal in current state **  
  

I didn’t get this error with the master branch of OpenFrameworks. Do someone have an idea ?

simply reading a video on ios is one of the more complicated bits. You might want to dig into that line and see what is actually blowing up. I suspect that it is due to the texture not being built correctly, or passed to the context correctly.

I am also curious about the status of this transition. There is some discussion-elsewhere-on-the-board.

I have got it working, but I am using very very little of the built in of stuff in my render path. It would be cool if some subset worked with gles2.0 (ofMesh, ofFbo, ofShader). Getting ofImage/ofTexture working would be nice as well, but maybe not super critical. Lighting would be nice as well, but seems more complex.

The hard part is making a nice default (passthrough) shader for people to use, and rewriting everything to use glVertexAttribPointer.