Ogre在 iOS上创建 es3.0 的 glContext

使用es3.0 可以支持ETC2格式的压缩纹理.

修改方法如下:

1、 找到工程生成目录下的include文件夹,即OgreBuildSettings.h所在的文件夹。

找到 OgreGLES2Config.h    修改该文件中的宏

    #define OGRE_NO_GLES3_SUPPORT 0

 

2、兼容低端机,如果不支持es3.0的设备,可以让其尝试创建es2.0

找到 CCES2Render-ios.m文件修改下面这个函数如下

// Create an OpenGL ES 2.0 context

- (id) initWithDepthFormat:(unsigned int)depthFormat withPixelFormat:(unsigned int)pixelFormat withSharegroup:(EAGLSharegroup*)sharegroup withMultiSampling:(BOOL) multiSampling withNumberOfSamples:(unsigned int) requestedSamples

{

    self = [super init];

    if (self)

    {

        if( ! sharegroup )

        {

            context_ = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3];

            if (! context_)

                context_ = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];

        }

        else

        {

            context_ = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3 sharegroup:sharegroup];

            if (!context_)

                context_ = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2 sharegroup:sharegroup];

        }

 

        if (!context_ || ![EAGLContext setCurrentContext:context_] )

        {

            [self release];

            return nil;

        }

        

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值