0

I've a strange problem with multiple render targets. I attached 3 textures to my FBO: color, normal and position. I can correctly render color and position, but rendering normal texture yields (green and red are part of a spinning cube):

enter image description here

In lower left corner, there is the result of rendering normal texture to a quad.

In my vertex shader, I'm computing normal as: normal = gl_NormalMatrix * gl_Normal, and in my fragment shader, I'm emitting it as: gl_FragData[1] = vec4(normal, 1);.

What's the issue here?

logain
  • 1,475
  • 1
  • 12
  • 18
pbp
  • 1,461
  • 17
  • 28

1 Answers1

0

Turns out I forgot to supply normals for rendered quads. Adding glNormal3f() calls fixed the problem.

pbp
  • 1,461
  • 17
  • 28