Jump to content
  • Advertisement
Sign in to follow this  
CNBABY

help :about glsl

This topic is 4816 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hello : my card is geforce fx 5200.i think it support GL_ARB_fragment_shader and GL_ARB_vertex_shader fully. i write my shading programs with glsl. but i found a exceptional thing------ i use the "discard;" in my fragment shader,but this statement is unuseful .just like i didn't write it. i don't know why .could you help me ?i have download the newest driver(7801) from nvidia web site,and setup it. please help me .please,please........

Share this post


Link to post
Share on other sites
Advertisement
my fragment code is just
main()
{
discard;
}
use it to render the scene ,i think my frame buffer isn't writen. but when i display my depth buffer as a texture, the result is same as that i didn't use the "discard;" :
main()
{
}

Share this post


Link to post
Share on other sites
I can tell you that the two small code snippets you posted are actually equivalent. Neither of them write anything to the colour buffer.

OpenGL Shading Language page 207:
"The only possible outcomes for a fragment shader are that it will output a fragment color, a fragment depth, or both a color and a depth or that the framebuffer will not be updated because the discard keyword was encountered."

Share this post


Link to post
Share on other sites
with gffx cards u get no performance benifits from using discard
use it like this

if ( some critera is meet eg vertex to far away from light )
discard; // ignore this fragment
else
....

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!