PDA

View Full Version : Very dark after multitexturing



B_old
11-02-2002, 03:30 AM
Hello.
I have implented multitexturing in my project and suddenly everything is very dark.
Is that a common effect or am I missing something.
Also I have to type
glActiveTextureARB(GL_TEXTURE0_ARB);
after having drawn my multitextured stuff or I will not see my HUD (in orthomode) which has nothing to do with multitexturing actually.
I think that is strange.
(I'm sorry to bother you but I'm afraid I won't get any help in the beginner forum although I certainly belong there)
Thanks for your time!

opla
11-02-2002, 03:55 AM
Are you using a Matrox Parhelia?
Even the nVidia's "Simple multitexture" tutorial doesn't work on it (upper right image is black).

Asgard
11-02-2002, 04:34 AM
I have implented multitexturing in my project and suddenly everything is very dark.

How dark the results of multitexturing are depends on what combine function and what textures you're using. Per default, the textures are multiplied together which might just make the result very dark, if one of the textures has values close to 0. You can change this behavior by setting a different texture combine function. Read the sections in the OpenGL spec dealing with texture environment modes and texture functions (section 3.8.13). Also there are loads of tutorials on the web regarding multitexturing. google is your friend http://www.opengl.org/discussion_boards/ubb/smile.gif


Also I have to type
glActiveTextureARB(GL_TEXTURE0_ARB);
after having drawn my multitextured stuff or I will not see my HUD (in orthomode) which has nothing to do with multitexturing actually.

If you're using a texture for rendering the HUD it has a lot to do with multitexturing, since then you have to set a texture for the HUD somewhere. You probably want to set it in texture unit 0 and therefore have to set the active texture unit using glActiveTexture before you set the texture.

Regards.

B_old
11-02-2002, 04:34 AM
Nope.
I use a GeForce2.
It is working, in my own application things appear quite dark though.
(I was even thinking it did not work untill I increased monitor brightness http://www.opengl.org/discussion_boards/ubb/smile.gif.
Now I can see stuff due to brighter textures, but still that does not seem to be the right approach)

After having drawn my multitexturestuff I type this now:
glActiveTextureARB(GL_TEXTURE1_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD);
glActiveTextureARB(GL_TEXTURE0_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
which makes my HUD light again.
It makes no sense to me though as nothing in my HUD-code has anything to do with multitexturing...

EDIT:
Sorry Asgard, your post came while I was designing this one.
Well, I did not have to set any TextureUnit before. Do yu know what I mean?
Is there no way to go back to 'SingleTextureMode'?

Ummmm. where are the OpenGL-specs located?
(so sorry, many times)

And another thing! I don't even have 2 textures on every side of the test-cube and still it is very dark!

[This message has been edited by B_old (edited 11-02-2002).]

Asgard
11-02-2002, 04:44 AM
It makes no sense to me though as nothing in my HUD-code has anything to do with multitexturing...

You should really read the texturing chapters in the OpenGL specs. It'll make sense to you then.


Well, I did not have to set any TextureUnit before.

That's because you were only using texture unit 0.


Is there no way to go back to 'SingleTextureMode'?

Do glActiveTexture(GL_TEXTURE0) and disable all texture enables on texture unit 1.


Ummmm. where are the OpenGL-specs located?
www.opengl.org (http://www.opengl.org)

B_old
11-02-2002, 05:06 AM
Ah, very well!
You were absolutely right about disabling the second texture unit, thanks!

If I'd be allowed another question before jumping into the OGL-specs it would be something like 'what is the difference between GL_TEXTUREx and GL_TEXTUREx_ARB?'

Your help was extremly usefull, though!
Thanks alot!

Asgard
11-02-2002, 05:40 AM
Multitexturing didn't use to be part of core OpenGL, but only an OpenGL extension called ARB_multitexture. The rule is that all name tokens used in extensions are suffixed with the first part of the extension name before the underscore. When an extension gets adopted as a part of core OpenGL the suffix gets dropped. Thus GL_TEXTURE0_ARB (and all the other tokens of ARB_multitexture) became GL_TEXTURE0 with the advent of OpenGL 1.2.1 where ARB_multitexture became a part of core OpenGL.

B_old
11-02-2002, 07:15 AM
Ah interesting!
So there is no real difference for me then?

zed
11-02-2002, 12:02 PM
tryb using ADD_SIGNED for combining method.
check out the arb_combine extension also u can scale the final output by 2

B_old
11-03-2002, 01:34 AM
I only use the none-ARB functions now.
Zed, do you mean using ARB and none-ARB functions together kind of? Why would I want to do that?

Also I took my definitions (or are they just declarations?) straight from the glext.h and the ARB and none-ARB really seem to be the same.
Thanks for the help guys!

Overmind
11-03-2002, 05:00 AM
Not only the definitions are the same, the functions are exactly the same. wglGetProcAddress("glActiveTexture") and wglGetProcAddress("glActiveTextureARB") return the same value.

jwatte
11-03-2002, 07:41 AM
Overmind,

Just because that's true on YOUR machine, doesn't necessarily mean it's true for everyone.

However, the ARB extensions usually get promoted to core status in some future version of the language, which means that it's often safest/easiest to just expose the same function with two names in that case. That doesn't make it guaranteed.