PDA

View Full Version : float texture: OpenGL vs OpenGL ES



rldivide
12-09-2012, 06:24 AM
Hi,

I'm a little lost on how to create a float texture, between OpenGL 2.0 and OpenGL ES 2.0...


I used to do this on OpenGL:



glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, width, height, 0, GL_RGBA, GL_FLOAT, data);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F_ARB, width, height, 0, GL_RGBA, GL_FLOAT, data);
glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA32F_ARB, width, height, 0, GL_ALPHA, GL_FLOAT, data);
glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA16F_ARB, width, height, 0, GL_ALPHA, GL_FLOAT, data);


The 3rd argument being the internal storage format (VRAM), the 7th the number of channel in the source picture (RAM), and the 8th the source picture channel format (RAM).
However it looks like theses rules are no more valid with OpenGL ES 2, the manual is not very clear on that matter... From what I've understood only the 8th argument define the internal channel format ?



glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_FLOAT, data);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_HALF_FLOAT_OES, data);
glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, width, height, 0, GL_ALPHA, GL_FLOAT, data);
glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, width, height, 0, GL_ALPHA, GL_HALF_FLOAT_OES, data);


1/ Am I right in both my examples ?
2/ Is there an universal way (GL/GL ES compatible) of creating a float texture ?
3/ With GL ES, what's the use of the defines GL_RGBA32F_EXT, GL_RGBA16F_EXT, GL_ALPHA32F_EXT and GL_ALPHA16F_EXT ?
4/ With GL ES, when you create a FLOAT16 texture, does it assume the source picture is FLOAT32 ?


Thanks !

rldivide
12-10-2012, 01:04 AM
Replying to myself:
1/ Yes
2/ No

A google engineer who has worked on Chrome GPU acceleration is talking about it here:
https://www.khronos.org/webgl/public.../msg00142.html (https://www.khronos.org/webgl/public-mailing-list/archives/1005/msg00142.html)

And the OpenGL/OpenGL ES registries also shows this difference:
http://www.opengl.org/registry/specs/ARB/texture_float.txt

New Tokens:
...
RGBA32F_ARB 0x8814
RGBA16F_ARB 0x881A
ALPHA32F_ARB 0x8816
ALPHA16F_ARB 0x881C


http://www.khronos.org/registry/gles/extensions/OES/OES_texture_float.txt

New Tokens:
...
HALF_FLOAT_OES 0x8D61
FLOAT 0x1406