"Thinking out loud" post - will contain a lot of errors!I've been looking into some makeshift way of overriding GLBasic's EAGLContext initialization when it generates mobile device code.
Thinking out loud, these are my initial assumptions:
- The existence of X_SETSHADER means that GLBasic is using the OpenGL 2.0 spec when available. Therefore, 2.0 functions are implemented
somewhere in GLBasic. I'm assuming they are mostly interchangeable with OpenGL ES 2.0 calls.
- When GLBasic builds a mobile app (Android or iOS), the generated code creates a v1.1 GL Context. I'm looking for a way to switch this into a 2.0 context (Looking at
this currently for iOS).
- Possible roadblock: even if we somehow manage to override the GLContext code that GLBasic generates with inline C/C++, does GLBasic arbitrarily block shader-related code from being built into mobile projects? It looks like the answer is probably
no since shader functions return a "fail."
I'm hoping this "false" response isn't hard coded by GLBasic, but rather comes from the OpenGL implementation (which returns false if you attempt shaders in a 1.1 context). If GLBasic is simply blocking 2.0 functions on mobile devices in a pre-determined way, then this is hopeless.
English version: Is the error "FAILED TO LOAD SHADER" coming from GLBasic, or OpenGL? I hope GLBasic leaves it to the OpenGL implementation (not hard coded in GLBasic generated mobile code).
Does anyone see any potential here?
edit: My approach here is iOS-centric. Android might be easier! It seems the Android API provides functions for switching the context version. For example:
MGLsurfaceview.SetEGLContextclienntVersion(2)Would be good if someone more knowledgeable on Android could chime in.