Tessellation vertices/triangles count

Hello folks,

i’ve got the following problem:

I actually working on my bachelorthesis. My title is “Displacement Mapping with Tessellation”.

I am almost finished, but i need the numbers of triangles/vertices to do some comparisons.

I am working with the JMonkey3-Engine(JME3) and OpenGL under windows. JME3 provides a statsView, the problem there is that it only gives you the number of your object you created.
For example: I create a triangle so I have 3 Vertices and 1 Triangle, now I start my programm and raise the TessellationLevel, but the counts are not increasing because the Tessellation is in the GPU.
Now there is my question, how can I get the numbers?

Here are my Shader Stages (a simple one, without DisplacemetMapping):


//vertex-shader

uniform mat4 g_WorldMatrix;

in vec3 inPosition;
out vec3 vPosition;

void main() {
	vec4 position = g_WorldMatrix * vec4(inPosition, 1.0);
	position /= position.w;
	vPosition = position.xyz;		
}

//TC

layout(vertices = 3) out;

in vec3 vPosition[];

out vec3 tcPosition[];

uniform float m_InnerTess;
uniform float m_OuterTess;
 
   void main()
{
        tcPosition[gl_InvocationID] = vPosition[gl_InvocationID];


    if (gl_InvocationID == 0) {
        gl_TessLevelInner[0] = m_InnerTess;
        gl_TessLevelOuter[0] = m_OuterTess;
        gl_TessLevelOuter[1] = m_OuterTess;
        gl_TessLevelOuter[2] = m_OuterTess;     
    }
}

//TES

layout(triangles, equal_spacing, ccw) in;

in vec3 tcPosition[];

out vec3 tePosition;

uniform mat4 g_ViewProjectionMatrix;

vec3 interpolate3D(vec3 v0, vec3 v1, vec3 v2)
{
   	 return vec3(gl_TessCoord.x) * v0 + vec3(gl_TessCoord.y) * v1 + vec3(gl_TessCoord.z) * v2;
}

void main()
{
        
   	 tePosition = interpolate3D(tcPosition[0], tcPosition[1], tcPosition[2]);	
	gl_Position = g_ViewProjectionMatrix * vec4(tePosition, 1.0);
}

//FS

out vec4 outFragColor;

void main() {
        vec4 color = vec4(1.0);
        outFragColor = color;       
}

That is my code for a single triangle to tessellate, by giving him the number of the tessellationlevel.
I guess i have to look at the TES because he gives me the vertices to draw.

If you have any more question, feel free to ask, I hope you guys can help me.

Hmm, I’m not terribly familiar with tessellation, but isn’t the number of triangles produced a function of (number of input triangles, m_InnerTess, m_OuterTess), in other words can’t you calculate the information you need if you have the former three values? Alternatively you could use an atomic counter to count triangles/vertices.

GL can tell you how many triangles were generated. Read up about the GL_PRIMITIVES_GENERATED query.