iOS OpenGL 函数renderbufferStorage:fromDrawable:

Create a color renderbuffer. Allocate its storage by calling the context’srenderbufferStorage:fromDrawable: method, passing the layer object as the parameter. The width,height and pixel format are taken from the layer and used to allocate storage for the renderbuffer.
myEAGLLayer = (CAEAGLLayer*)self.layer;

GLuint colorRenderbuffer;


glGenRenderbuffers(1, &colorRenderbuffer);glBindRenderbuffer(GL_RENDERBUFFER, colorRenderbuffer);


[myContext renderbufferStorage:GL_RENDERBUFFER fromDrawable:myEAGLLayer];


glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,GL_RENDERBUFFER, colorRenderbuffer);

Note WhentheCoreAnimationlayer’sboundsorpropertieschange,yourapplicationshouldreallocate the renderbuffer’s storage. If you do not reallocate the renderbuffers, the renderbuffersize won’t match the size of the view; in this case, Core Animation may scale the image’s contentsto fit in the view. To prevent this, the Xcode template reallocates the framebuffer and renderbufferwhenever the view layout changes. 


版权声明:本文为博主原创文章,未经博主允许不得转载。

转载于:https://www.cnblogs.com/zsw-1993/archive/2012/11/02/4880680.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值