Hi there,
I'm trying to implement different image processing algorithms like grayscaling, filtering, quantizing etc. on Android smartphones. I've got the camera preview rendered to a quadas an external texture, it works fine with grayscaling in fragment shader. But when I try to do the same in OpenGL ES 3.1 with compute shaders, I get invalid operation error,when calling glBindImageTexture(...) before dispatch compute. According to https://www.khronos.org/registry/gles/extensions/OES/OES_EGL_image_external_essl3.txt
if I bind an external texture like GL_TEXTURE_EXTERNAL_OES and bind it with glBindImageTexture, I should be able to access the image via image2D sampler in GLSL.What am I doing wrong?
Hi, fireblade
this is just a code tip, not an address to your already solved issue.
You can make your code less verbose by using static imports. This avoid that you have to type GLES31 in every single static method call.
just add it to your imports:
import static android.opengl.GLES31.*;
Example for Math:
import static java.lang.Math.*;
public class HelloWorld{
public static void main(String []args){
// no need to type Math.sin() and Math.cos() - just sin() and cos()
System.out.println("Hello static import: " + sin(0.2312f) * cos(0.2312f) );
}
Thanks for the advice aborges, well I did know that, but you can call it a bad habit, as I'm mainly developing in C++ and got used to write the namespaces everytime, in order to avoid misunderstandings.