Glsl and pn_triangles

How do I export normals from glsl vertex shader in order to make ATI_pn_triangles work? Everything looks fine using fixed pipeline but using glsl vertex shader results in some polygons missing (R9600, Catalyst 05.1). Is it a bug or It’s not possible to make these two extensions to work together?

  • pn_triangles supported in hardwsare only in ATI R2x0(which not suppor GLSL).
  • R3x0(including R9600)/R4x0 - doesn’t support it(may be in software).
  • R3x0(including R9600)/R4x0 - doesn’t support it(may be in software).

You have to enable it via Control Panel. After that you can see ATI_pn_triangles in extensions list.

Are you asking how to tell it which attribute is a position and which ones are normals? I think the only way to do that is to actually use the position and normal attributes (and therefore glVertexPointer and glNormalPointer).

I’m doing all of that. I’m passing data to OpenGL as arrays (both vertex a normals). Vertex shader (glsl) looks like that:

varying vec3 n;

gl_Position = ftransform();
//gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
n = normalize(gl_NormalMatrix * gl_Normal);

The only problem is that some polygons inside scene are missing. Without vertex shading everything is allright.

I’ve read pn_triagles and there’s written:
(3) How does this extension interact with the EXT_vertex_shader and ARB_vertex_program programmable vertex shader extensions?

RESOLVED: The PN Triangle tessellation algorithm requires the presence of both vertex position and normal. Therefore, if an application enables PN Triangle tessellation and has a programmable vertex shader enabled, that shader should export the fixed-function equivalent of position and normal. "

I simply don’t know how to export normals from vertex shader. There’s no gl_OutputNormal. The spec si written agains ARB_vertex_program but there’s no “result.normal” either.

Stange thing is that I have got the same shader and same geometry rendered via DirectX + HLSL and
it’s working…

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.