Jump to content

  • Log In with Google      Sign In   
  • Create Account


Ignifex

Member Since 25 Jul 2004
Offline Last Active Jan 03 2014 04:10 PM
-----

Posts I've Made

In Topic: Learning GLSL all over again

06 March 2013 - 06:34 AM

It seems you are looking for glBindFragDataLocation, which tells glsl what output variable writes to which color target. By default, if only a single output is specified for the fragment shader, that variable is chosen as the output to the (first) bound color buffer.

 

Depth is a separate case, since only a single depth buffer can be bound at a time. No separate variable should be declared and it is not required to write to the depth manually. If you wish to do so anyway, you can use gl_FragDepth.


In Topic: GLSL issues between ATI and Nvidia Cards

22 January 2013 - 05:43 AM

Just to point out a potential problem:

 

vec3 CalcPointLight(int _index, vec3 _normal) {
    vec3 LightDirection = worldPos0 - pointLights[_index].position;
    ...
}

 

It looks like your lightdirection is reversed with respect to your normal and eye vector. This could cause a lot te become black for the diffuse term and might mess up your specular computation as well (negative x in pow(x, y)), but it sounds like you solved that already.

 

What combination of lights have you used for testing? What happens when you use only a directional light?


In Topic: Problem with shaded triangle

09 October 2012 - 04:44 AM

I first noticed that your triangle is not interpolating between red, green and blue, but between cyan, magenta en yellow. So somewhere your colors are being "reversed".

Your problem is indeed in the code fragment you have shown below. The interpolation between corner points does not depend linearly on the distance, but the inverse of it. If the distance to your red point (d0) is very small, your "red weight" should be high.

You can have a look at Barycentric coordinates, which seem to most closely match what you are doing.

In Topic: Cylindrical texture coordinates

14 September 2012 - 08:08 AM

The second form, the "open" cylinder, is the common solution used in almost every model exporter available. The reason is exactly as you have mentioned.
Texture coordinates are not the only attribute that can differ per vertex on the model. Multiple normals are also commonly available, forcing even more splitting into multiple "single attribute" vertices.

In Topic: Camera inside walls and use of stencil buffer

13 September 2012 - 02:57 AM

To me at least, it is still not very clear what you are trying to achieve.
As for your direct question, you could have a look at the depth of the fragment you are drawing in your pixel shader, using eg. gl_FragCoord.z. You can compare this value to 0, which will usually be the depth value at the near-plane, possibly shade the fragment in a different way, and then modify the depth that is used to compare it using gl_FragDepth.

PARTNERS