using OpenTK.Graphics.OpenGL4; public class Measure_time { private int[] ids = new int[1]; public Measure_time() { GL.GenQueries(1, ids); } public void begin() { GL.BeginQuery(QueryTarget.TimeElapsed, ids[0]); } public bool is_end() { GL.GetQueryObject(ids[0], GetQueryObjectParam.QueryResultAvailable, out long result); return result > 0 ? true:false; } public void end() //Unit nanosecond { GL.EndQuery(QueryTarget.TimeElapsed); } public long result() { GL.GetQueryObject(ids[0], GetQueryObjectParam.QueryResult, out long result); return result; } public void release() { GL.DeleteQueries (1, ids); } }
沒有留言:
張貼留言