I'm trying to port some OpenGLES code from iOS to Android.
In iOS I have this code:
- (void)setColorOn:(BOOL)yes
{
glUniform1i(colorOnUniform, yes);
}
where the glUniform1i() method takes an Integer as a Uniform location and a Boolean.
In Android, the closest I can get is this:
public void setColorOn() {
GLES20.glUniform1i(colorOnUniform, 0);
}
where the glUniform1i() method takes an Integer as a Uniform location and another Integer, I think as a texture id...
I've dug around the Kronos documentation, but can't seem to find a proper translation ...
Thoughts ?
Wait what? The glUniform1i
takes 2 integers in both cases. Why the developer inserted a boolean value I have no idea. Anyway the iOS boolean value translates as YES
(true) = 1 and NO
(false) = 0. This value is probably used in shader as if(colorOnUniform == 0)...; else...;
This method should probably be like:
- (void)setColorOn:(BOOL)yes
{
glUniform1i(colorOnUniform, yes?1:0);
}
Issue resolved...