• cegui HorzFormatting VertFormatting 用tiled导致的效率低下


    一个 比较大的ui 比如全屏状态

    背景的渲染格式 如果用tiled 透明的黑色背景 帧率下降20

    改为stretched 帧率下降10

    背景不用一个像素平铺 用一张比较大地透明黑色背景会不会好些

    这个问题确切的说是 带alpha通道的 一个像素 铺成的整张背景的 HorzFormatting VertFormatting 设置

    ============

    哈这个人遇到的问题和我一样 stretched的话颜色淡 不是想要的样子 tiled 效率巨低下

    I have the following problem. I'm trying to skin a button using a number of 1 pixel wide images.
    Specifically, the 4 corners are 2x2, the top and bottom edges are 1x2, the left and right edges are 2x1 and the background is 1x1.

    The problem I have is that if I set the HorztFormat and VertFormat to Stretched, the background appears as a very pale, transparent "smear" over the surface of the button. The "color intensity" also appears to be modulated, with the middle of the control being about the color I want, and the colour fading to transparent towards the edges.
    (The edges also are inconsistent in colour.)

    If I set the formatting to Tiled, I get the look I desire (a uniform color) but performance goes way, way down. The whole thing runs so slowly that it's unusable. Otherwise I'd just Tile and be done.

    I'm hoping someone can tell me what I'm doing wrong, and how to fix it. (My initial thought was that the single pixel is somehow being antialiased with an alpha channel. I do note that the source image, not supplied by me, contains an alpha component.)

    http://www.cegui.org.uk/phpBB2/viewtopic.php?t=2183

    ==============================================

    解决方案 在第二页

    http://www.cegui.org.uk/phpBB2/viewtopic.php?t=2146&start=0&postdays=0&postorder=asc&highlight=pixel 

    开始他们讨论的不是这个问题

    ===============

    综上 stretched 有两个弊端:

    1 颜色不是我们想要的 只有中间是到边缘就变淡了 不是纯色的均匀的透明

    2 第二个帖子里说到的 大小可变的纹理

    解决方案就是必然用tiled 但是怎么解决效率问题呢

    先生成一个tiled的texture之后就用这个纹理

    可以的话让美工直接做一个纯色纹理不就行了么

    我去试下两个方法

    这么小的字 这么多字。。恶心死我了 太伤眼睛了!!!

    让美工做一个大地黑色透明背景的方法不可取。。因为要从网络上传一个很大地图片。。某人认为浪费资源

     CEGUI creates one texture in memory and draws the tiles into it, then uses that one texture to draw the bg

    解决方案:

    void TiledTexture(const std::string& strWinName)
    {
     int i = 0;
     int j = 0;
     static DWORD dwTiledTex[1024][768];
     for(i=0; i<1024; i++)
     {
      for(j=0; j<768; j++)
      {
       dwTiledTex[i][j] = D3DCOLOR_RGBA( 0, 0, 0, 100 );
      }
     }
     CEGUI::Size size(1024, 768);
     CEGUI::Point pxy(0, 0);

     CEGUI::Texture* tex = ( &CEGUI::System::getSingleton().getRenderer()->createTexture(size) );
         tex->loadFromMemory((void*)dwTiledTex, size, CEGUI::Texture::PF_RGBA);
     CEGUI::ImagesetManager* ImgSetMgr = &CEGUI::ImagesetManager::getSingleton();
         ImgSetMgr->create("TiledTex"+strWinName, *tex,CEGUI::XMLResourceExistsAction::XREA_REPLACE);

     CEGUI::Window  *pwnd=CEGUI::WindowManager::getSingleton().getWindow(strWinName);
     CEGUI::Imageset* ImgSet = &ImgSetMgr->get("TiledTex"+strWinName);
     ImgSet->defineImage("_full_image_", pxy, size, pxy);
     pwnd->setProperty("Image", "set:TiledTex"+strWinName+" image:_full_image_");
    }

  • 相关阅读:
    查看资源加载各环节具体耗时的利器
    WebStorm 格式化代码快捷键
    Android 如何使edittext默认失去焦点
    html语义化练习易牛课堂代码
    html网页练习豆瓣网
    HTML前期学习总结
    视频课阶段基础知识总结
    MQ、JMS 关系的理解
    Jvm参数配置
    Java泛型
  • 原文地址:https://www.cnblogs.com/minggoddess/p/2267597.html
Copyright © 2020-2023  润新知