int primitivesCount; int query; // Create and begin query on the number of primitives generated GL.GenQueries(1, out query); GL.BeginQuery(QueryTarget.PrimitivesGenerated, query); // Draw some geometry here // End query and get the result GL.EndQuery(QueryTarget.PrimitivesGenerated); GL.GetQueryObject(query, GetQueryObjectParam.QueryResult, out primitivesCount);In this example code, we first generate a query object using the GL GenQueries function. Then we begin the query by calling GL BeginQuery and passing in the QueryTarget corresponding to the number of primitives generated. Next, we draw some geometry and then end the query using GL EndQuery. Finally, we retrieve the query result using the GL GetQueryObject function. The package library for this function is OpenTK, which is a set of OpenGL bindings for C#.