BASIC

Author Topic: Multitexture Shader  (Read 8286 times)

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10720
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Multitexture Shader
« 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]
« Last Edit: 2008-Jul-11 by Kitty Hello »

Sebastian

  • Guest
Re: Multitexture Shader
« Reply #1 on: 2008-Jul-11 »
Nice, this will come in handy  =D

Offline Schranz0r

  • Premium User :)
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 5028
  • O Rly?
    • View Profile
Re: Multitexture Shader
« Reply #2 on: 2008-Jul-11 »
cool...  :nw:
I <3 DGArray's :D

PC:
AMD Ryzen 7 1700 @3.9GHz, 16GB HyperX Fury 3000MHz Ram, ASUS ROG GTX 1060 STRIX 6GB, Windows 10 Pro 64Bit, MSi Tomahawk B350 Mainboard

Offline WPShadow

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1667
    • View Profile
    • http://lostrevenant.blogspot.com
Re: Multitexture Shader
« Reply #3 on: 2008-Jul-12 »
Great!  :booze:
AMD X2 4600, 2 GB Ram, ATI X1950 XTX, XP PRO SP2: GLB Premium 10.beta_dingsi, <(´.´<) Kirby Dance (>`.`)>
http://lostrevenant.blogspot.com
alea iacta est

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1635
  • Particle Hawk
    • View Profile
Re: Multitexture Shader
« Reply #4 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.

Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10720
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: Multitexture Shader
« Reply #5 on: 2009-Nov-23 »
oh no!!! I didn't do anything (intentionally).
Hm. My shaders work.

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1635
  • Particle Hawk
    • View Profile
Re: Multitexture Shader
« Reply #6 on: 2009-Nov-23 »
gernot, recompile this project, and try again....it changes.
The original exe works fine, but when it is compiled....blah
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10720
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: Multitexture Shader
« Reply #7 on: 2009-Dec-15 »
??? Are you sure? I mean - when you reboot. Does the new exe still not run?

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1635
  • Particle Hawk
    • View Profile
Re: Multitexture Shader
« Reply #8 on: 2009-Dec-15 »
Ahh...i had to move MT.frag into the .app folder, duuh.  :S
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1635
  • Particle Hawk
    • View Profile
Re: Multitexture Shader
« Reply #9 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.
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1635
  • Particle Hawk
    • View Profile
Re: Multitexture Shader
« Reply #10 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
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)