zoukankan      html  css  js  c++  java
  • (转)primitive restarting

    红宝书里面的 2.6.4 重启图元 一开始没理解 后来找了下面的资料就OK了

     

    void glPrimitiveRestartIndex(GLuint index);


    Primitive restart functionality allows you to tell OpenGL that a particular index value means, not to source a vertex at that index, but to begin a new primitive of the same type with the next vertex. In essence, it is an alternative to glMultiDrawElements. This allows you to have an element buffer that contains multiple triangle strips or fans (or similar primitives where the start of a primitive has special behavior).

    The way it works is with the function glPrimitiveRestartIndex. This function takes an index value. If this index is found in the index array, the system will start the primitive processing again as though a second rendering command had been issued. If you use a BaseVertex drawing function, this test is done before the base vertex is added to the restart. Using this feature also requires using glEnable to activate it, and the corresponding glDisable to turn it off.

    Here is an example. Let's say you have an index array as follows:

    { 0 1 2 3 65535 2 3 4 5 }

    If you render this as a triangle strip normally, you get 7 triangles. If you render it with glPrimitiveRestartIndex(65535) and the primitive restart enabled, then you will get 4 triangles:

    {0 1 2}, {1 2 3}, {2 3 4}, {3 4 5}

    Primitive restart works with any of the versions of these functions.


    Warning: It is technically legal to use this with non-indexed rendering. You should not do this, as it will not give you a useful result.

  • 相关阅读:
    docker 的官方PHP镜像 如何修改 php.ini 配置
    数据结构和算法
    接口的幂等性
    linux ftp服务器设置,只允许用户访问指定的文件夹,禁止访问其他文件夹
    rabitmq + php
    微信上传客服消息图片
    golang Printf 函数有超过 10 个转义字符
    golang bufio.NewScarme
    springboot(一)
    springboot加入第三方jar,使用mvn打包
  • 原文地址:https://www.cnblogs.com/shane/p/3037210.html
Copyright © 2011-2022 走看看