Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


#Actualblueshogun96

Posted 05 March 2013 - 04:33 PM

Sorry to start another thread about GLSL, but right now, I'm getting confused with GLSL 150.  It looks like quite a bit has changed since the last time I ever touched GLSL.  

 

What I really have a hard time figuring out (from what few and obscure tutorials I find on the net) is how does OpenGL know what is the vertex or fragment colour?  There's no more gl_FragColour, and I've seen the output colour variable change so often.  I looked though the OpenGL code and I don't see anything that specifies what is the fragment colour.  This is really confusing and I haven't found much straight forward information either.  Almost everything uses GLSL 330 or above, which I can't use since I'm confined to OpenGL 3.2 on MacOSX.  Any help is appreciated.

 

Shogun.

 

EDIT: Let me explain what I'm talking about in greater detail.

 

See this vertex program?

 

#version 150
 
in  vec3 in_Position;
in  vec3 in_Color;
out vec3 ex_Color;
 
void main(void)
{
	ex_Color = in_Color;
	gl_Position = vec4(in_Position, 1.0);
}

 

The vertex colour is set in ex_Color.  I've seen this differ for other vertex programs.  in_Color is already bound, that I understand.

 

p = glCreateProgram();
    
	glBindAttribLocation(p,0, "in_Position");
	glBindAttribLocation(p,1, "in_Color");

 

But how does OpenGL know that ex_Color is the fragment colour?  Just because it has out vec3 in front of it as it's variable type?  How would it know the difference between other vertex attributes then???

 

The same with the fragment program...

 

#version 150
 
in  vec3 ex_Color;
out vec4 out_Color;
 
void main(void)
{
	out_Color = vec4(ex_Color,1.0);
}

 

This time ex_Color is the input colour.  How does OpenGL know the difference??  I'm sorry if this is really obvious, but IMO, this doesn't look very straight forward compared to older versions of GLSL.


#1blueshogun96

Posted 05 March 2013 - 04:25 PM

Sorry to start another thread about GLSL, but right now, I'm getting confused with GLSL 150.  It looks like quite a bit has changed since the last time I ever touched GLSL.  

 

What I really have a hard time figuring out (from what few and obscure tutorials I find on the net) is how does OpenGL know what is the vertex or fragment colour?  There's no more gl_FragColour, and I've seen the output colour variable change so often.  I looked though the OpenGL code and I don't see anything that specifies what is the fragment colour.  This is really confusing and I haven't found much straight forward information either.  Almost everything uses GLSL 330 or above, which I can't use since I'm confined to OpenGL 3.2 on MacOSX.  Any help is appreciated.

 

Shogun.


PARTNERS