Skip to main content
GameDev.net gamedev.net
🔒 Locked

Combinerfunction to GLSL

Started by dnaxx Apr 29, 2006 at 1:57 AM 1 replies 1k views
Original Post
dnaxx
dnaxx
Hello! I have 2 textures: a color map and a detail texture. Without GLSL I use a combiner function to combine these textures:

glActiveTextureARB(GL_TEXTURE0_ARB); 
// Bind color map
glActiveTextureARB(GL_TEXTURE1_ARB); 
//Bind detail texture
glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT); 
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_ADD_SIGNED_EXT); 

Now I must do this combiner operation in a GLSL shader. Therefore I tried two things 1.) Multiply the color myp with the detail texture 2.) Add the detail texture to the color map. Both ways *work* but 1.) outputs a dark result and 2.) a to bright result. Can someone please give me hint how to fix this and/or how "GL_ADD_SIGNED_EXT" exactly works (formula)? Thank you,
dnaxx
dnaxx
already got it. It's a+b-0.5
LangFox
LangFox
Yes. With ps you could do any pixel operation as you wish. The basic formulas are just like the alpha blend.
http://358574108.qzone.qq.com

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.