ios - GLKView : Trouble with offscreen RenderBuffer with Core Animation Layer -
i trying attach renderbuffer following apples guide here.
my problem if try create fbo way, 2 scenarios happen :
a) if draw thing or call self.binddrawable()
prior renderbufferstorage(_:_:)
, renderbufferstorage
return false
, whole thing fails
b) if run 2 functions below before call binddrawable
or draw anything, renderbuffer created, error when try draw :
failed bind eagldrawable: gl_renderbuffer 2 failed make complete framebuffer object 8cd6
private func initframebuffer() -> gluint { var framebuffer_id: gluint = 0 glgenframebuffers(1, &framebuffer_id) glbindframebuffer(glenum(gl_framebuffer), framebuffer_id) return framebuffer_id } private func initrenderbuffer() -> gluint { var renderbuffer_id: gluint = 0 glgenrenderbuffers(1, &renderbuffer_id); glbindrenderbuffer(glenum(gl_renderbuffer), renderbuffer_id); let status = context.renderbufferstorage(int(gl_renderbuffer), from: layer as! caeagllayer) glframebufferrenderbuffer(glenum(gl_framebuffer), glenum(gl_color_attachment0), glenum(gl_renderbuffer), renderbuffer_id) return renderbuffer_id }
i sat glkview such :
context = eaglcontext(api: .opengles3) drawablecolorformat = .rgba8888
Comments
Post a Comment