• <small id='GlkmD'></small><noframes id='GlkmD'>

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

        使用 OpenGLES 的抗锯齿去除绳索的锯齿状边缘

        时间:2024-08-12

      2. <tfoot id='yWfs5'></tfoot>
          <legend id='yWfs5'><style id='yWfs5'><dir id='yWfs5'><q id='yWfs5'></q></dir></style></legend>

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

                    <tbody id='yWfs5'></tbody>

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

                  本文介绍了使用 OpenGLES 的抗锯齿去除绳索的锯齿状边缘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我已经实现了绳索,其中我使用旋转关节连接动态 b2bodied,现在我成功地创建了这条绳索,但我的绳索看起来并不光滑,我希望它们像丝带一样光滑.任何对此有想法的人!我发现它可以通过openGLES使用抗锯齿来实现,但仍然不知道究竟如何实现这一点..任何形式的帮助都将不胜感激.

                  i have implemented ropes in which i have used Revolute joints to connect dynamic b2bodied , now i successfully created this ropes but my ropes not looking smoothy , i want them smooth just like ribbons . anyone having idea on this !! i found that it could be achieved by openGLES using anti-aliasing but still not getting idea that exactly how to achieve this .. any kind of help would be appreciated .

                  我的绳子是多边形的动态体,这样b2BodyDef 身体定义;bodyDef.type = b2_dynamicBody;bodyDef.position = currentPos;

                  my Rope is polygon shaped dynamic body , this way b2BodyDef bodyDef; bodyDef.type = b2_dynamicBody; bodyDef.position = currentPos;

                  b2PolygonShape polygonShape;
                  polygonShape.SetAsBox(linkWidth,linkHeight);
                  
                  b2FixtureDef fixtureDef;
                  fixtureDef.density =20.0;
                  
                  fixtureDef.shape = &polygonShape;
                  
                  b2Body* link = world->CreateBody( &bodyDef );
                  link->CreateFixture( &fixtureDef );
                  

                  旋转关节:

                  b2RevoluteJointDef revoluteJointDef;
                  revoluteJointDef.localAnchorA.Set( 0,  linkHeight);
                  revoluteJointDef.localAnchorB.Set( 0, -linkHeight);            
                  revoluteJointDef.bodyA = link;
                  revoluteJointDef.bodyB = lastLink;
                  world->CreateJoint( &revoluteJointDef );
                  

                  请帮忙.

                  我希望我的绳索更顺畅,就像最右边的图片一样

                  i want my ropes smoother just like right most image

                  我的输出看起来像这样

                  my output looks like this

                  推荐答案

                  如果你想去除纹理的边缘,你必须启用多重采样.多重采样将作用于整个屏幕,启用它会带来性能损失,在旧设备 (iPhone 3GS) 上最为严重.

                  You will have to enable multisampling if you want to get rid of the edges of textures. Multisampling will act on the entire screen and enabling it will have a performance penalty, most severely on older devices (iPhone 3GS).

                  在AppDelegate中找到CCGLView实例化的那一行,开启多重采样,设置采样数为2或4.

                  Locate the line where CCGLView is instantiated in AppDelegate, and enable multi sampling and set the number of samples to 2 or 4.

                  CCGLView *glView = [CCGLView viewWithFrame:[window bounds]
                  pixelFormat:kEAGLColorFormatRGBA8    // <-- use whichever is your default
                  depthFormat:GL_DEPTH_COMPONENT24_OES // <-- use whichever is your default
                  preserveBackbuffer:NO
                  sharegroup:nil
                  multiSampling:YES    // <-- enable
                  numberOfSamples:4];  // <-- set to 2 or 4
                  

                  要记住的一件事:在 Retina 设备上,由于显示屏的高分辨率,您将无法看到锯齿状边缘.在 2D 应用程序中对 Retina 设备进行多重采样可能会浪费性能,并且几乎不会提高图像质量.这给您留下了另一种选择:考虑只支持 Retina 设备,或者干脆忽略非 Retina 设备上存在的问题,因为它们无论如何都会消失.

                  One thing to keep in mind: on Retina devices you won't be able to see the jagged edges due to the high resolution of the display. Multisampling on Retina devices in a 2D app is likely a waste of performance and hardly increases image quality. That leaves you with another option: consider to just support Retina devices, or simply ignore that the issue exists on non-Retina devices because they're about to go away anyway.

                  顺便说一句,CCTexture2D 锯齿和抗锯齿方法名称容易混淆,它们不执行全屏或纹理边缘锯齿或抗锯齿.它们在线性(antialias",模糊)和最近(alias",无过滤)之间更改纹理的过滤模式.

                  Btw, the CCTexture2D aliasing and antialiasing methods are confusingly named, they do not perform full-screen or texture-edge aliasing or antialiasing. They change the texture's filtering mode between linear ("antialias", blurry) and nearest ("alias", no filtering).

                  效果是纹理中的像素要么被线性过滤,因此单个像素的颜色逐渐变化,而最近过滤不执行此类过滤.像素艺术和瓦片地图瓦片集纹理最常需要最近过滤.两者都只改变纹理像素的过滤模式,而不是它们的边缘.为此,您需要多重采样.

                  The effect is that pixels within a texture are either linear filtered and thus individual pixel colors gradually change, whereas nearest filtering does not perform such filtering. Nearest filtering is most commonly needed for pixel art and tilemap tileset textures. Both only change filtering modes of the texture's pixels and not their edges. For that you need multisampling.

                  这篇关于使用 OpenGLES 的抗锯齿去除绳索的锯齿状边缘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:cocos2d 在场景之间移动 下一篇:“‘NSData’没有可见的@interface 声明选择器‘base64EncodedString’"MKS

                  相关文章

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

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

                • <legend id='n7qtJ'><style id='n7qtJ'><dir id='n7qtJ'><q id='n7qtJ'></q></dir></style></legend>

                    <bdo id='n7qtJ'></bdo><ul id='n7qtJ'></ul>
                  <tfoot id='n7qtJ'></tfoot>