Use 3D Texture for Fragment shader on Android

I need to use 3D Texture in my fragment shader on Android, but get compiling error. I use GLES3.0 and I think it should support 3D texture. My shader looks as follows:

#extension GL_OES_texture_3D : enable

precision mediump float;

uniform sampler3D u_Texture;

Without “#extension GL_OES_texture_3D : enable” I got error " L0003: Keyword ‘sampler3D’ is reserved"

With “#extension GL_OES_texture_3D : enable”, I got error “S0032: no default precision defined for variable ‘u_Texture’”

Even I use “uniform medium float sampler3D u_Texture”, I got “Expect, found sampler3D” error.

Hope get your help!

Many thanks.

  1. You needn’t declare #extension GL_OES_texture_3D : enable for OpenGL ES 3.x because it has supported since OpenGL ES 3.0 version inside core.

  2. This share can be compiled succesfully(I used mali offline compiler malisc.exe --fragment fs.glsl):

    #version 300 es
    in mediump vec2 texCoord;
    out mediump vec4 color;
    uniform mediump sampler3D Texture;
    void main()
    mediump vec4 v3 = texture(Texture, vec3(texCoord.xy, 0.5));
    color = v3;

Many thanks, AndreyOGL_D3D!
It works.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.