<bdo id='H4tDs'></bdo><ul id='H4tDs'></ul>

    <tfoot id='H4tDs'></tfoot>

  1. <i id='H4tDs'><tr id='H4tDs'><dt id='H4tDs'><q id='H4tDs'><span id='H4tDs'><b id='H4tDs'><form id='H4tDs'><ins id='H4tDs'></ins><ul id='H4tDs'></ul><sub id='H4tDs'></sub></form><legend id='H4tDs'></legend><bdo id='H4tDs'><pre id='H4tDs'><center id='H4tDs'></center></pre></bdo></b><th id='H4tDs'></th></span></q></dt></tr></i><div id='H4tDs'><tfoot id='H4tDs'></tfoot><dl id='H4tDs'><fieldset id='H4tDs'></fieldset></dl></div>
  2. <small id='H4tDs'></small><noframes id='H4tDs'>

    1. <legend id='H4tDs'><style id='H4tDs'><dir id='H4tDs'><q id='H4tDs'></q></dir></style></legend>
    2. 填充抗锯齿聚 cocos2d

      时间:2024-08-12
        <tbody id='j7RZG'></tbody>

      <small id='j7RZG'></small><noframes id='j7RZG'>

        <i id='j7RZG'><tr id='j7RZG'><dt id='j7RZG'><q id='j7RZG'><span id='j7RZG'><b id='j7RZG'><form id='j7RZG'><ins id='j7RZG'></ins><ul id='j7RZG'></ul><sub id='j7RZG'></sub></form><legend id='j7RZG'></legend><bdo id='j7RZG'><pre id='j7RZG'><center id='j7RZG'></center></pre></bdo></b><th id='j7RZG'></th></span></q></dt></tr></i><div id='j7RZG'><tfoot id='j7RZG'></tfoot><dl id='j7RZG'><fieldset id='j7RZG'></fieldset></dl></div>
        <tfoot id='j7RZG'></tfoot>
            • <legend id='j7RZG'><style id='j7RZG'><dir id='j7RZG'><q id='j7RZG'></q></dir></style></legend>

                <bdo id='j7RZG'></bdo><ul id='j7RZG'></ul>
                本文介绍了填充抗锯齿聚 cocos2d的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                如何在 Cocos2D 框架中绘制填充多边形?

                How can I draw filled poly in Cocos2D framework?

                下面的代码绘制多边形但没有抗锯齿.我应该改变什么?

                Code below draws poly but without antialiasing.What should I change?

                void ccFillPoly( CGPoint *poli, int points, BOOL closePolygon )
                {
                    // Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY
                    // Needed states: GL_VERTEX_ARRAY,
                    // Unneeded states: GL_TEXTURE_2D, GL_TEXTURE_COORD_ARRAY, GL_COLOR_ARRAY
                    glDisable(GL_TEXTURE_2D);
                    glDisableClientState(GL_TEXTURE_COORD_ARRAY);
                    glDisableClientState(GL_COLOR_ARRAY);
                
                    glVertexPointer(2, GL_FLOAT, 0, poli);
                    if( closePolygon )
                        //   glDrawArrays(GL_LINE_LOOP, 0, points);
                        glDrawArrays(GL_TRIANGLE_FAN, 0, points);
                    else
                        glDrawArrays(GL_LINE_STRIP, 0, points);
                
                    // restore default state
                    glEnableClientState(GL_COLOR_ARRAY);
                    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
                    glEnable(GL_TEXTURE_2D);
                }
                

                推荐答案

                模拟抗锯齿的一个好方法是在多边形周围添加透明顶点.这种方法快速且美观,但实施起来并不难.这里是抗锯齿线的解决方案.

                One good approach to emulate antialiasing is to add transparent vertices around your polygon. This method is fast and fine-looking, but is little hard to implement. Here is solution for antialiased lines.

                如果您不担心性能,您可以多次渲染多边形,并具有一定的透明度并偏移 1 个像素.这适用于没有纹理的多边形.

                If you don't worry about performance, you may render the polygon multiple times with some transparency and offset by 1 pixel. This would work for not textured polygons.

                这篇关于填充抗锯齿聚 cocos2d的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:如何从 CCScrollView 上的按钮更改标签文本? 下一篇:Cocos2d中Sprites在两点之间画一条线Sprite

                相关文章

                  <bdo id='y42NU'></bdo><ul id='y42NU'></ul>

                <legend id='y42NU'><style id='y42NU'><dir id='y42NU'><q id='y42NU'></q></dir></style></legend>

                1. <small id='y42NU'></small><noframes id='y42NU'>

                  <tfoot id='y42NU'></tfoot>
                  1. <i id='y42NU'><tr id='y42NU'><dt id='y42NU'><q id='y42NU'><span id='y42NU'><b id='y42NU'><form id='y42NU'><ins id='y42NU'></ins><ul id='y42NU'></ul><sub id='y42NU'></sub></form><legend id='y42NU'></legend><bdo id='y42NU'><pre id='y42NU'><center id='y42NU'></center></pre></bdo></b><th id='y42NU'></th></span></q></dt></tr></i><div id='y42NU'><tfoot id='y42NU'></tfoot><dl id='y42NU'><fieldset id='y42NU'></fieldset></dl></div>