i'm currently trying to create a OpenGL ES 2.0 application for the IPad with MonoTouch.
I already managed to:
- Load Models
- Use & Compile Shaders
- Display a 3D Model
At this point i want to use a skybox for my background and show some UI-Buttons.
To make thinks short here are problems:
[subheading]1. Cube Map is shown colorized red[/subheading]
I noticed that i get a GL_INVALID_OPERATION error when calling glUniform{i} ( Mono Touch hides the specific implementations ) and i think the sampler-id is never given to the shader correctly.
// [...] Active Program etc [...]
Int32 count = 0;
foreach (TextureParameter texture in parameters.TextureParameters)
{
(texture.Texture as Texture).Use(count);
// No error above this line
GL.Uniform1(_Uniforms[texture.Name].Location, count++);
// GL_INVALID_OPERATION here
}
The "Use(count)" method does the following:
if (_Handle != 0)
{
if (slot > 31 || slot < 0) throw new ArgumentOutOfRangeException("slot");
GL.ActiveTexture((All)((Int32)All.Texture0 + slot));
GL.BindTexture(TextureType, _Handle);
// Texture type is in this case All.TextureCubeMap
}
Of course the shader has the uniform and the location of it is 3 ( There is also a MVP-Matrix ).
The shader compiler shows no errors so the shader should work.
[subheading]2. Set Model-View-Projection Matrix via glUniformMatrix [/subheading]
I'm trying to set the MVP matrix via the glUniformMatrix, but this generates also a GL_INVALID_OPERATION error. ( Note: It's not the same shader! )
This also worked in other shaders.
At this point i'm very annoyed, because it consumes a lot of time, and the project is urgent anyway.
I've tryed a lot of things to make it work, but it won't.
I've also posted the question on stackoverflow and you can grab some bounty for the questions. ( [1] [2] )
Cheers
Felix