Jump to content
  • Advertisement
Sign in to follow this  
huaner

semanteme of window pixel position in shader

This topic is 4075 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

Hi: if we know the window position, I want to give this pixel a different color.I heard that is a semanteme to get it.but, i can't find it.so, i compute it by manual.
varying vec4 position;
uniform float WindowWide;
uniform float WindowHeight;
void main()
{
	float x, y;
	x = Wide * 0.5 + position.x * ( Wide * 0.5 );
	y = Height * 0.5 + position.y * ( Height * 0.5 );
	if( x == 200 && y == 200)
		gl_FragColor = vec4(0.0, 1.0, 0.0, 0.0);
	else
		gl_FragColor = vec4(1.0, 0.0, 0.0, 0.0);
}
thank you!

Share this post


Link to post
Share on other sites
Advertisement
semanteme == function =) funny translation though.

Anyway, you haven't actually asked a question. Does your method work?

-me

Share this post


Link to post
Share on other sites
I hardly believe it since '==' in floating point is almost equal to NEVER. Range checking is definetly necessary here!

I would expect all pixels to be red.

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!