GLBasic forum

Codesnippets => 3D-snippets => Topic started by: Kitty Hello on 2008-Jul-11

Title: Multitexture Shader
Post by: Kitty Hello on 2008-Jul-11
When using X_SETTEXTURE a,b _after_ X_SETSHADER, the 2 "uniform smapler2D" vaiables "TextureID1" and "TextureID2" will be set.

Here's an example how to do multitexturing. Move the mouse left-right for the mixing factor.

You need a new update to GLBasic (online tomorrow)

[attachment deleted by admin]
Title: Re: Multitexture Shader
Post by: Sebastian on 2008-Jul-11
Nice, this will come in handy  =D
Title: Re: Multitexture Shader
Post by: Schranz0r on 2008-Jul-11
cool...  :nw:
Title: Re: Multitexture Shader
Post by: WPShadow on 2008-Jul-12
Great!  :booze:
Title: Re: Multitexture Shader
Post by: Hemlos on 2009-Nov-21
Old post, yes.

However, GLSL hasnt changed on my computer, yet this code no longer works the way it was originally working.

Did you change something with the shaders internally since this post, gernot?

I did notice a change a while back....all my shaders seem to be broken now.

Title: Re: Multitexture Shader
Post by: Kitty Hello on 2009-Nov-23
oh no!!! I didn't do anything (intentionally).
Hm. My shaders work.
Title: Re: Multitexture Shader
Post by: Hemlos on 2009-Nov-23
gernot, recompile this project, and try again....it changes.
The original exe works fine, but when it is compiled....blah
Title: Re: Multitexture Shader
Post by: Kitty Hello on 2009-Dec-15
??? Are you sure? I mean - when you reboot. Does the new exe still not run?
Title: Re: Multitexture Shader
Post by: Hemlos on 2009-Dec-15
Ahh...i had to move MT.frag into the .app folder, duuh.  :S
Title: Re: Multitexture Shader
Post by: Hemlos on 2009-Dec-15
Ahhh, my stupidity has let me stumble on a bug...

IF X_LOADSHADER(12, "", "MT.frag") = FALSE
   END
ENDIF


This didnt end the program as intended, it allowed me to continue to run, even though the shader wasnt loaded...i didnt have it in the app dir, and yet it still was running, without the shader.
Title: Re: Multitexture Shader
Post by: Hemlos on 2009-Dec-15
And a minor bug in the sample...

The torus is texturing the Y dimension upside down, making the words upside down.

This is the original code:
Code: (glbasic) [Select]
X_OBJADDVERTEX x,y,z,  thetaFracTex*TextureWrapVert, wrapFracTex*TextureWrapHoriz, col
Here is the fix:
Code: (glbasic) [Select]
X_OBJADDVERTEX x,y,z,  thetaFracTex*TextureWrapVert, -wrapFracTex*TextureWrapHoriz, col