Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Sep 12th, 2012  |  syntax: Python  |  size: 0.73 KB  |  views: 37  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import wx
  2. import wx.glcanvas
  3.  
  4. import numpy
  5. from OpenGL.GL import *
  6. from OpenGL import GLUT
  7. from OpenGL.GL.framebufferobjects import *
  8.  
  9. class App(wx.App):
  10.     def OnInit(self):
  11.         frame = wx.Frame(None, title = "Test OpenGL framebuffers")
  12.         panel = wx.Panel(frame)
  13.         self.canvas = wx.glcanvas.GLCanvas(panel)
  14.         frame.Show()
  15.         self.canvas.Bind(wx.EVT_PAINT, self.onPaint)
  16.         self.context = wx.glcanvas.GLContext(self.canvas)
  17.         self.haveInited = False
  18.         return True
  19.  
  20.     def onPaint(self, event):
  21.         self.canvas.SetCurrent(self.context)
  22.         if not self.haveInited:
  23.             glGenFramebuffers(1)
  24.             self.haveInited = True
  25.  
  26. App(redirect = False).MainLoop()