Archived

This topic is now archived and is closed to further replies.

Android_s

Question about glActiveTextureARB() and texture states ..?

Recommended Posts

Android_s    164
I have a question about glActiveTextureARB() and what info it stores with the texture-layer and what not. I found this with google: glActiveTextureARB selects which texture unit subsequent texture state calls will affect... Perhaps i should ask what exactly is a "texture state call"? My problem, more exactly, is that i have several layers i need to blend together and i need some way to "store" blendFunc params with the texture layer so i later can render my face in one pass, with the correct blending... I saw somewhere that glBlendFunc() is not a state call (oh, why not?) and that i must use glTexEnv() instead. But how...there must be constants to glTexEnv that i have missed, because frankly i can''t see how to get the blending effects using the "usual" ones constants to be close to what glBlendFunc does... Hope i didn''t confuse you too much, tricky thing to explain... I''ll be happy for any response

Share this post


Link to post
Share on other sites
ALX    122
glBlenFunc indeed sets a state, but not a texture state. glBlendFunc acts on the blending stage in the pipeline, which is totally unrelated to the textures. It is therefore not stored in a texture object, such as for example glTexEnv is. Both are different concepts: the blending stage blends between multiple passes, while the texture environment combines multiple textures.

glTexEnv (and friends) are much, much more powerful than the primitive blending stage, except that you cannot access a fragment from the previous pass (ie. from the framebuffer). But for operations between two or more textures, you can get every effect you get with glBlendFunc, and infinitely more. You''ll have to go beyond OpenGL 1.1 though, look at the wide choice of texture environment extensions available:

* ARB_texture_env_combine
* ARB_texture_env_crossbar
* ARB_texture_env_dot3
* NV_register_combiners
* ARB_fragment_program
* ARB_fragment_shader

... and many more.

Share this post


Link to post
Share on other sites
ALX    122
The primary reference for extensions is the official extension registry: clicky.

The ARB_texture_env_* extensions all use new constants for the glTexEnv() function family.

NV_register_combiners don''t use glTexEnv, but define a whole list of new entry points.

And for ARB_fragment_program and ARB_fragment_shader, you''ll have to learn new programming languages (Shader ASM for ARB_fragment_program, and GLSL for ARB_fragment_shader).

Share this post


Link to post
Share on other sites
Android_s    164
Right, so i have studied that site, more speciffically the ARB_tex_env_combine document and come up with some strange effects, but none of what i was trying to get...

I would appreciate some help with this, like how a texture is read and processed by all those calls. For example, i want to create a simple "masking" effect using a 32-bit tga image. When uning glBlendFunc i passed GL_SRC_ALPHA and GL_ONE. Now i have no idea how to write...every attempt to create that simple masking effect end up in missery..

Share this post


Link to post
Share on other sites