开发者

How to draw NURBs with OpenGL ES

开发者 https://www.devze.com 2023-03-08 09:05 出处:网络
In OpenGL NURBs can be drawn using evaluators. But it seems ev开发者_StackOverflow社区aluators were removed from OpenGL ES spec to make it light weight. In that case, how can one draw NURBs using Open

In OpenGL NURBs can be drawn using evaluators. But it seems ev开发者_StackOverflow社区aluators were removed from OpenGL ES spec to make it light weight. In that case, how can one draw NURBs using OpenGL ES API?


You won't get around implementing the NURBS stuff yourself. Meaning you have to sample the curve or surface at discrete points and thus convert it to an ordinary line strip or triangle set respectively. This can then be drawn with the usual vertex arrays/buffers, which should also be faster than evaluators or the GLU NURBS functions.


In openGL, NURBS curves are rendered in 2 steps - 1) evaluate some points (100 or 1000) on the curve using the mathematical formula. This can be done on GPU in openGL4, using the SSBOs (Shader Storage Buffer Objects). 2) render the evaluated points as line strip, using the VBOs.

If you want to understand the NURBS in more detail, then there is a nice web-app available here.

0

精彩评论

暂无评论...
验证码 换一张
取 消