Forum Cross Platform with Xamarin
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

OpenTK-1.0 calling Destroy/CreateFramebuffer obliterates context...Why?

GameViews in OpenTK-1.0 initialize the context in CreateFramebuffer() and destroy said context in DestroyFramebuffer(). What if I want to hold onto my VBOs and just create a bunch of new FBOs? For example, on rotation, I need to create newly sized FBOs, but I don't want to have to completely reload all my VBOs and I just don't understand how this would work without completely reimplementing all/most of GameView. I can't just override these two methods, because the base class does not expose a setter on Renderbuffer or Framebuffer. What am I missing here?

In sum: I want to rotate the device and get a new OpenTK-1.0 FBO, but not destroy the context. If anyone knows how to do this, please let me know.

Posts

  • StefanosAStefanosA CHMember

    As you said, CreateFramebuffer() constructs a new OpenGL ES context. You should only need to call this method once.

    To create FBOs you should use GL.GenFramebuffers() instead.

  • DanBelcherDanBelcher USMember ✭✭

    Stefanos-

    Thanks for the reply. I feel like I'm still missing something about the design of OpenTK 1.0's GameView class. If you set Autoresizes to true, you get a call to DestroyFramebuffer() and CreateFramebuffer(). As you pointed out, CreateFramebuffer() does destroy the context, but this is not what I want. Normally, I'd just subclass and override, but - since GameView manages the handles to the Framebuffer and Renderbuffer - and they don't have public setters, I was stuck. After looking at this for awhile, it simply seems like poor design to me.

    Since OpenTK-1.0's source is closed (AFAIK), I couldn't simply rework the class as I liked.

    (In fact, I abandoned GameView completely because of this issue.)

Sign In or Register to comment.