• Advertisement

Archived

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

Problem with GL_NV_texture_env_combine4

This topic is 5840 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, I have a problem with using the mentioned extension. I use the following code and it''s task would be to draw the texture in its ''true'' color, isn''t it? However it draws the texture with blue color... Why is this? glColor4f(1,1,1,1); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE4_NV); glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_ADD); glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE0_ARB); glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_PRIMARY_COLOR_EXT); glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE2_RGB_EXT, GL_ZERO); glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE3_RGB_NV, GL_ZERO); glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_COLOR); glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR); glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND2_RGB_EXT, GL_SRC_COLOR); glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND3_RGB_NV, GL_SRC_COLOR); Draw(); Thanks in advance! -- tSG --

Share this post


Link to post
Share on other sites
Advertisement
A/ is lighting enabled?
B/ (i havent looked at that extension for a while) but what u have here is exactlly the same as

GL_MODULATE (ie no combine no nothing)


http://uk.geocities.com/sloppyturds/gotterdammerung.html

Share this post


Link to post
Share on other sites
To just render the texture colour, you don''t need any of the texture_env_combine extensions. All you need to do is:

a) Set the current drawing colour and use an environment function of GL_MODULATE
b) Use an environment function of GL_DECAL.

Death of one is a tragedy, death of a million is just a statistic.

Share this post


Link to post
Share on other sites
Oh yes, I know that I could use GL_MODULATE instead this... ''cause this is just a test, I would like to blend two textures with a certain alpha over each other. That could be easily done in two passes but I would like to use the multitexturing...
Btw. lighting is disabled so that can''t be a problem


-- tSG --

Share this post


Link to post
Share on other sites
sounds like u want tex env combine + use the interpolate method whichll let u use
tex0 * A + tex1 * (1-A)
A can be the alpha of a texture

http://uk.geocities.com/sloppyturds/gotterdammerung.html

Share this post


Link to post
Share on other sites
zedzeek is exactly right, you want to use the standard GL_EXT_texture_env_combine extension using the GL_INTERPOLATE token.

Death of one is a tragedy, death of a million is just a statistic.

Share this post


Link to post
Share on other sites
quote:
Original post by zedzeek
sounds like u want tex env combine + use the interpolate method whichll let u use
tex0 * A + tex1 * (1-A)
A can be the alpha of a texture

http://uk.geocities.com/sloppyturds/gotterdammerung.html


I don''t think so. The extension says:
"Should textures from other texture units be allowed as sources?
- No, not in the base spec. Too many vendors have expressed concerns about the scalability of such functionality. This can
be added as a subsequent extension."
I think that says that multitexturing is not supported by standard GL_EXT_texture_env_combine... And meanwhile the NV extension docs says that NV tex env extension is an extension of this - with support of multitexturing.
Please correct me if I know something incorrectly.



-- tSG --

Share this post


Link to post
Share on other sites
Read the OpenGL 1.2.1 manual, it''s got a good section on how the multitexturing engine works. Look up fragments...

Death of one is a tragedy, death of a million is just a statistic.

Share this post


Link to post
Share on other sites
quote:

I don''t think so. The extension says:
"Should textures from other texture units be allowed as sources?
- No, not in the base spec. Too many vendors have expressed concerns about the scalability of such functionality. This can
be added as a subsequent extension."


This quote only refers to the capability of a texture combine stage to *directly* access texture sources of other combine units, without passing through the full texture pipeline. This is only useful for very advanced shading effects, and has been realized in the combine4 extensions, the crossbar ext. or directly through register combiners. For your simple equation you don''t need it at all. It''s just standard multitexture routing offered by ext_tex_env_combine. You should familiarize yourself with the basic principles of multitexturing and the workings of the texture pipeline.

NV_texture_env_combine4 is nic, if you want to do equations such as c = cf * (ct0 + ct1). This simple equation just can''t be done using any standard texture_env equation.

Share this post


Link to post
Share on other sites
Ahh, thank you for pointing out that! I will definitely look at the opengl1-2-1 specifications for more details. Thanks!


-- tSG --

Share this post


Link to post
Share on other sites
>>"Should textures from other texture units be allowed as sources?<<

ok thats correct but it still lets u do

tex0 * tex0 alpha + tex1 * (1-tex0 alpha)

http://uk.geocities.com/sloppyturds/gotterdammerung.html

Share this post


Link to post
Share on other sites

  • Advertisement