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.
page32image11544
myEAGLLayer = (CAEAGLLayer*)self.layer;

page32image14088

GLuint colorRenderbuffer;


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


[myContext renderbufferStorage:GL_RENDERBUFFER fromDrawable:myEAGLLayer];


glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,GL_RENDERBUFFER, colorRenderbuffer);
page32image17264

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. 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值