Skip to main content
gamedev.net
🔒 Locked

Texture-Multitexture , complex

Started by dawidjoubert Dec 15, 2005 at 12:55 PM 2 replies 850+ views
Original Post
dawidjoubert
dawidjoubert
Hi there, Im using Multitexturing with 4 units. I currently have this config for the blending Base = 100% Cliff = RGB Detail = ALPHA Lightmap = ALPHA I would like to have Base = 100% Cliff = R Detail = G Lightmap = B Can any1 help me set this up, is it possible? Here is how i set the Detial/light map
[Source]
		glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
		glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_INTERPOLATE_ARB);

		glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS_ARB);
		glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);

		glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE);
		glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR);

		glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB_ARB, GL_PRIMARY_COLOR_ARB);
		glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB_ARB, GL_SRC_ALPHA);
[/Source]
And here is how i set the cliff texture
[Source]
glActiveTextureARB(GL_TEXTURE1_ARB);
		glEnable(GL_TEXTURE_2D);
		glBindTexture(GL_TEXTURE_2D,CliffTexture);

		glMatrixMode(GL_TEXTURE);
		glLoadIdentity();
		glScalef(0.15f,0.15f,0.15f);

		glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
		glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_INTERPOLATE_ARB);

		glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS_ARB);
		glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);

		glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE);
		glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR);

		glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB_ARB, GL_PRIMARY_COLOR_ARB);
		glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB_ARB, GL_SRC_COLOR);
[/Source]
Now all i want to do is set them at the end instead of GL_SRC_COLOR to GL_SCR_COLOR_RED or GL_SOURCE_COLOR_BLUE and so on. Is this possible? If not can i set a main colour multiplier which changes the lighting of the object?
----------------------------http://djoubert.co.uk
Unreal
Unreal
this days I was searching for the same thing.
You can not access individual channels of the texture unless you use a pixel shader. (or maybe some other Vendor specific extension.. dunno!)
dawidjoubert
dawidjoubert
Thanks alot, that just sucks.. I think its the first limitation of OpenGL that i have reached without looking into Cg..

Guess Cg is the way to go huh?
Well anyways i think i will look towards a lightmap (texture) then. Thanks :-)
----------------------------http://djoubert.co.uk
bluntman
bluntman
I would say if you are sticking to OpenGL then GLSL is at least as good a choice as Cg, as it is fully supported without the need for any extra API or DLLs.
I started trying to use Cg, but the syntax and API for GLSL just makes alot more sense to me after using OpenGL for so long.

Topic Locked

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

Sign in to reply to this topic.