# GS in GLSL 1.2

This topic is 2348 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Anyone have any tutorials on how to take in TRIANGLES and output the TRIANGLE_STRIPS for tessellation using GL2.1 with the geometry shader?

#version 120

I can't find much of any useful info on the GLSL 1.2 version....

Thanks!

##### Share on other sites
Hidden
BUMP!!!!

Hello, I am new to GS in GLSL and would like to create a tessellated triangle and have it calculate the normals per vertex....

This is what I have so far....
 void main() { float centerX, centerY; for(int x = 0; x < 8; x++) { for(int y = 0; y < 8; y++) { centerX = -0.9 + 0.2 * x; centerY = 0.9 - 0.2 * y; gl_Position = gl_ModelViewProjectionMatrix * vec4(centerX - 0.1, centerY - 0.1, 0.0, 1); EmitVertex(); gl_Position = gl_ModelViewProjectionMatrix * vec4(centerX, centerY + 0.1, 0.0, 1); EmitVertex(); gl_Position = gl_ModelViewProjectionMatrix * vec4(centerX + 0.1, centerY - 0.1, 0.0, 1); EmitVertex(); EndPrimitive(); } } } 

but it only shows a grid of triangles... I want to take my current quad(2 triangles) and tessellate it to have more polygons to avoid texture tearing on hill sides ect...

Thanks!

BTW any tutorials on GLSL 1.2 version of this would be great as I can't find any...

##### Share on other sites
So, the first point is that the GS is not really for tessellation. Yes, you can approximate it by outputting new triangles but it's not quite the same thing (works in a different domain for one thing).

If you want to approximate tessellation then you'll need to use the input vertices and create a new set of vertices between them, the maths for which shouldn't be too hard (mostly lerps to get vertices between each location as required).

iirc GLSL1.2 just expanded the language a bit, it should't be too hard to get up to speed on it from the spec.