B3D brush and texture blend modes (GL equivalents)

BlitzMax Forums/OpenGL Module/B3D brush and texture blend modes (GL equivalents)

AdrianT(Posted 2005) [#1]
I was wondering if anyone had the information in regards to what each of these are in OpenGL. Coukdn't find a proper answer using the search feature of the forums. Any help would be useful. I'm not sure whether the brush and texure blendmodes are actually the samething so I listed them seperately.



BRUSH BLENDMODES:

Alpha:
Multiply:
Add:

TEXTURE BLENDMODES

Alpha:
Multiply:
Add:
Dot3:
Modulate2X:


ImaginaryHuman(Posted 2005) [#2]
I am not familiar with Blitz3D. But in BlitzMax,

`Alpha` is SetBlend ALPHABLEND
`Add` is SetBlend LIGHTBLEND
`Multiply` is SetBlend SHADEBLEND

I don't know what the Dot3 or Modulate 2X do. You might look at setting up your own modes with glBlendFunc() and glEnable(GL_BLEND). You might be able to use glBlendFunc(SRC_ALPHA_SATURATE,GL_ONE) to achieve something like a `2x` modulation, but I have no idea if thats the same thing.


AdrianT(Posted 2005) [#3]
thanks :) thats a good start anyway :)


Vertex(Posted 2005) [#4]
Hi!
Dot3:
' glActiveTexture GL_TEXTURE0+Layer
' glBindTexture GL_TEXTURE_2D, MyNormalMap
glTexEnvf GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT
glTexEnvf GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_DOT3_RGB_EXT

Add:
glTexEnvf GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_ADD

Modulate:
glTexEnvf GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE

One texture:
glTexEnvf GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_REPLACE

cu olli


Duck(Posted 2006) [#5]
Hi,

Here's Modulate2x:

'---------------------------------------------------------------------------
'grass texture
glActiveTextureArb(GL_TEXTURE0_ARB)
glEnable(GL_TEXTURE_2D)
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE)
glBindTexture(GL_TEXTURE_2D, grassTex)

'lightmap using modulate2x
glActiveTextureArb(GL_TEXTURE1_ARB)
glEnable(GL_TEXTURE_2D)
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE)
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE)
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_PREVIOUS)
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR)
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_TEXTURE)
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR)
glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE, 2.0)
glBindTexture(GL_TEXTURE_2D, lightMapTex)
'-----------------------------------------------------------------------


You can also get 4x by changing 2.0 to 4.0 in "glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE, 2.0)"


ImaginaryHuman(Posted 2006) [#6]
What version of GL does that modulate need? Or an extension?


Duck(Posted 2006) [#7]
OpenGL 1.1 and ARB_multitexture are required for this extension.

The ARB description is at :

http://oss.sgi.com/projects/ogl-sample/registry/ARB/texture_env_combine.txt

I tried this out with BlitzMax and everything was ok.