Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#ActualiLoveGameProgramming

Posted 19 January 2013 - 10:48 AM

First of all thank you for taking time to answer my question.
I am very new to shaders.

I am trying to fade out my lines using shaders,
this picture shows exacly what I need:

 

whatIreallyreallywant%20copy.png




My Fragment Shader:
void main() {
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}

My Vertex Shader:
void main() {
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}

This works, and colors them red. Is there a way to check position of the pixel I am coloring. So then I can compare it to the distance away from the beginning of the line. Using that value to calculate the Alpha of the FragColor?
Unless there is another way?

Thank you smile.png


#3iLoveGameProgramming

Posted 19 January 2013 - 10:46 AM

First of all thank you for taking time to answer my question.
I am very new to shaders.

I am trying to fade out my lines using shaders,
this picture shows exacly what I need:
http://dl.dropbox.com/u/13524574/public_Screens/whatIreallyreallywant%20copy.png

My Fragment Shader:
void main() {
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}

My Vertex Shader:
void main() {
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}

This works, and colors them red. Is there a way to check position of the pixel I am coloring. So then I can compare it to the distance away from the beginning of the line. Using that value to calculate the Alpha of the FragColor?
Unless there is another way?

Thank you :)

#2iLoveGameProgramming

Posted 19 January 2013 - 10:46 AM

First of all thank you for taking time to answer my question.
I am very new to shaders.

I am trying to fade out my lines using shaders,
this picture shows exacly what I need:
http://dl.dropbox.com/u/13524574/public_Screens/whatIreallyreallywant%20copy.png

My Fragment Shader:
void main() {
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}

My Vertex Shader:
void main() {
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}

This works, and colors them red. Is there a way to check position of the pixel I am coloring. So then I can compare it to the distance away from the beginning of the line. Using that value to calculate the Alpha of the FragColor?
Unless there is another way?

Thank you :)

#1iLoveGameProgramming

Posted 19 January 2013 - 10:45 AM

First of all thank you for taking time to answer my question.

I am very new to shaders.

 

I am trying to fade out my lines using shaders,

this picture shows exacly what I need:

http://dl.dropbox.com/u/13524574/public_Screens/whatIreallyreallywant%20copy.png

 

My Fragment Shader:

 

 
void main() {
   gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}
 
void main() {            
    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}
 

This works, and colors them red. Is there a way to check position of the pixel I am coloring. So then I can compare it to the distance away from the beginning of the line. Using that value to calculate the Alpha of the FragColor?

Unless there is another way?


Thank you :)


PARTNERS