PDA

View Full Version : Missing TexEnv* functions



pion
12-18-2010, 08:04 AM
I am looking at this tutorial http://www.clockworkcoders.com/oglsl/tutorial8.htm which has the following codes:


glActiveTextureARB(GL_TEXTURE0_ARB);
glBindTexture(GL_TEXTURE_2D, texture1);
glEnable(GL_TEXTURE_2D);
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_REPLACE);

glActiveTextureARB(GL_TEXTURE1_ARB);
glBindTexture(GL_TEXTURE_2D, texture2);
glEnable(GL_TEXTURE_2D);
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_INCR);

I could not find the equivalent of glTexEnvf() function on WebGL Specification https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/doc/spec/WebGL-spec.html

I assume that they are omitted from WebGL. Correct?
If so, how do we do the equivalent features? Is it possible?

Thanks in advance for your help.

SteveBaker
12-18-2010, 09:10 AM
WebGL is based on OpenGL ES - not on OpenGL. OpenGL ES strips OpenGL to the barest minimum - and in OpenGL ES 2.0, we have shaders - and shaders can implement everything that glTexEnv does.

glTexEnv is all about how textures are applied to the base color of the polygon - and how textures are combined - but when you have fragment shaders, you get the raw texture values from 'texture2D' and you can decide whether the resulting color modifies the base polygon color - and how multiple textures are combined - using simple math operations.

So - you're right - glTexEnv isn't in WebGL or OpenGLES2 - and it's not needed.

Simpler is better - and shaders are cool!

-- Steve