Author Topic: X_PUTSHADER issue  (Read 1643 times)

Offline 9940

  • Mr. Drawsprite
  • **
  • Posts: 53
    • View Profile
X_PUTSHADER issue
« on: 2009-Aug-06 »
Code: GLBasic [Select]
uniform vec3 Color;
void main (void)
{
   gl_FragColor = vec4(Color, 1.0);
}
 

Code: GLBasic [Select]
X_SETSHADER 1
X_PUTSHADER "Color", XXXX
X_DRAWOBJ 0, 0
 

What I should put instead of XXXX since X_PUSHADER only supports floats?

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1631
  • Particle Hawk
    • View Profile
Re: X_PUTSHADER issue
« Reply #1 on: 2009-Aug-06 »
I had to edit my own code here.....GLSL is a very rigid language and unforgiving...

try 'main( void )'


And if that doesnt work, then try this:

Code: GLBasic [Select]
//Color.frag
uniform float R;
uniform float G;
uniform float B;

void main( void )
{
   gl_FragColor = vec4(R,G,B, 1.0);
}
 

Code: GLBasic [Select]
X_PUTSHADER "R", red
X_PUTSHADER "G", green
X_PUTSHADER "B", blue


btw i started a glsl thread recently:
http://www.glbasic.com/forum/index.php?topic=3148.0
« Last Edit: 2009-Aug-06 by Hemlos »
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)