Sign in to follow this  
huaner

semanteme of window pixel position in shader

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this