PDA

View Full Version : GLSL ES Version 100 texture lod access.



PsychoTodd
01-15-2018, 02:01 PM
Hello guys,

This is a platform related question. I have being using an extension on Windows and iOS platform : GL_EXT_shader_texture_lod. The reason is that I need this extension for textureCubeLodEXT. However, this won't work on Android since normally GL_EXT_shader_texture_lod is not implemented. However, I need to a way to explicitly assign the LOD levels when sampling the textures. Have anyone done it for Android?

I would appreciate if anyone can suggest how I can do it if I want to stick to GLSL ES V100 if possible.

Thank you in advance.

Todd

Dark Photon
01-16-2018, 06:14 AM
I haven't picked through the specs, but from:


GLSL ES Spec, ver 1.00 (https://www.khronos.org/registry/OpenGL/specs/es/2.0/GLSL_ES_Specification_1.00.pdf)

it appears that texture*Lod is supported in the core spec, albeit only in vertex shaders. Do you need this in a fragment shader, or can you make use of this in a vertex shader (possibly with a finer mesh and interpolation)?

If not, have you considered clamping the min/max sampling levels for the texture in GL state? That doesn't give you dynamic control of LOD in the shader, but if you need access to multiple LODs, you could possibly consider a pass per LOD.

GClements
01-16-2018, 08:56 AM
If not, have you considered clamping the min/max sampling levels for the texture in GL state? That doesn't give you dynamic control of LOD in the shader, but if you need access to multiple LODs, you could possibly consider a pass per LOD.
ES doesn't support clamping LoD (glTexParameter() is just filters and wrap modes). You'd have to make each mipmap level a separate texture.