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!


torelocks

Member Since 19 Sep 2011
Offline Last Active Oct 01 2011 09:39 AM

Topics I've Started

"Beginning OpenGL Game Programming 2nd edition" fragment shader compile problems

19 September 2011 - 03:11 PM

Hi guys, I'm hoping smeone can give me some advice.
I recently got "Beginning OpenGL Game Programming 2nd edition" by Luke Bernstead.

The first thing i have been doing is doing is reading through and compiling / running the projects.
When I get to the first one with a fragment shader (Chapter 6) however, it bombs out. After some debugging, I've narrowed it down to the fragment shader.

this is the supplied shader:

#version 130

in vec4 color;
out vec4 outColor;

void main(void) {
	outColor = color;	
}

I tried changing the shader to something like this, which allows the program to run but everything is rendered black:
void main()
{
	gl_FragColor = gl_Color;
}
[as far as I can tell this is deprecated anyway]


I also mentioned the vert shader works; here it is:
#version 130

uniform mat4 projection_matrix;
uniform mat4 modelview_matrix;

in vec3 a_Vertex;
in vec3 a_Color;
out vec4 color;

void main(void) 
{
	vec4 pos = modelview_matrix * vec4(a_Vertex, 1.0);
	gl_Position = projection_matrix * pos;	
	color = vec4(a_Color, 1.0);
}

When I investigate what glGetShaderInfoLog says, all i get is:

- Fragment Shader Fai

useful, huh?


Unfortunately, I'm new to this whole thing and after a lot of searching on-line I'm still at an impasse. I hoping by posting here someone would be able to help me.

Oh yeah, my laptop's graphics card is: ATI Radeon HD 4500 series. I ran GPUCapsViewer; which told me that the card is fully shader version 1.3 compatible.

Any help appreciated, am i doing something wrong?!

PARTNERS