Jump to content
  • Advertisement
Sign in to follow this  
nadro

GLSL how convert position value from app to good for GLSL?

This topic is 4138 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. I build multilight system and I create pseudo light data for per pixel point light: struct LightData { vec4 Diffuse; vec4 Ambient; vec3 Position; float constantAttenuation; float linearAttenuation; float quadraticAttenuation; }; LightData Light; I hame one problem with calculate position of light. I have this cos in shader: [VERTEX] varying vec4 ecPosition; ... ecPosition = gl_ModelViewMatrix * gl_Vertex; ... [FRAGMENT] uniform vec3 lightPosition; varying vec4 ecPosition; ... vec3 Aux; Aux = vec3(vec4(lightPosition,0.0)-ecPosition); // Here is my problem, because if I have: Aux = vec3(gl_LightSource[0].position-ecPosition); shader work good. In my apllication is one Light in position (Light.Position) vec3(-373,334,-11) and this value has lightPosition. How Can I convert my lightPosition to position good for my shader?

Share this post


Link to post
Share on other sites
Advertisement
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!