It is now possible to share the OpenGL state:
With
renderLoop.setOpenGLContextToThread
you can claim the context and release it with:
renderLoop.freeOpenGLContextFromThread
The renderloop omits any OpenGL calls if the context is not active.
Because of the polling and sync mechanism of /dev/input devices, there is a small latency in the gamepad control. Here is an example of the YAogl gamepad library for Linux:
In contrast to ugly while(forever) constructs, which are mostly entangled in the render-loop, my library uses lightweight threads for each connected device. Callbacks for device-change-events are also missing, therefore gamepads under Linux can only be detected at startup.
New Screenshots and update news available at: http://www.yousry.de/c-o-o-l-the-game/

You can also start the game multiple times:

I’m still struggling with OpenAL but I hope to finish this port in a few days. As I stated in an earlier post, this isn’t a simple x-compilation but an adaption to the the native os. The render-loop is completely rewritten. The new OpenGL 4+ features are factored-out to allow to play the game on older (2009+) hardware.
This is the first test with the new render-loop. I reused the couch-camel model for this test:
Update: There is a small bug in this demo. The Leafs of the tree should be 2D billboards an not 3D.
Version 1.4 of the Game C.O.O.L was submitted to the Itunes Store.
Version 1.4 is a Bugfix Update:
Previously known as B.I.S (Working Title: Business in Space) was uploaded to the Itunes store. Version 1.3 is a Bugfix Release:
All proprietary libraries were removed. YAogl now runs on all major mobile and desktop systems with support for OpenGL, OpenGL ES, OpenAL and Vorbis. With OpenGL 4.3 a great part of the render-loop now runs on the GPU.
I’m loosing a lot of performance with this shader. Instead of a sampler2Darray a lot of uniforms are depleted by c(like)-arrays:
uniform sampler2D textureMap[4];
...
lowp vec4 texColorA = texture2D(textureMap[0], texPos);
lowp vec4 texColorB = texture2D(textureMap[1], texPos);
lowp vec4 texColorC = texture2D(textureMap[2], texPos);
lowp vec4 texColorD = texture2D(textureMap[3], texPos);
...
lowp vec4 colorMix = vsTextureMix.x * texColorA +
vsTextureMix.y * texColorB +
vsTextureMix.z * texColorC +
vsTextureMix.w * texColorD;
...
The textures thereby have to be bound individually:
[[terrainTextures objectAtIndex:0] bind: GL_TEXTURE0];
[[terrainTextures objectAtIndex:1] bind: GL_TEXTURE1];
[[terrainTextures objectAtIndex:2] bind: GL_TEXTURE2];
[[terrainTextures objectAtIndex:3] bind: GL_TEXTURE3]; // precious texture units!
GLuint loc = shader.locTextureMap; // the mirrored GL State-Machine
if(loc != -1) {
int txs[] = {0,1,2,3};
glUniform1iv(loc, 4, txs);
}
The terrain textures are mipmaps with repeating texture-wraps and accordingly can’t be arranged in an atlas.
Also the OpenGL ES statement-evaluation differs from the desktop specification.
For Example the branch-avoiding statement:
// Instead of If (x <= y) e; else 0; example *= float(x <= y);
doesn't work with several ES systems until you use an unequal inversion:
example *= float(x > y);
Bugfix Release: