Advertisement
Guest User

My minimal working code gtkd/gl

a guest
Sep 21st, 2015
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.59 KB | None | 0 0
  1. import gtk.Main;
  2. import gdk.GLContext;
  3. import gtk.GLArea;
  4. import gtk.MainWindow;
  5. import gtk.Widget;
  6.  
  7. import derelict.opengl3.gl3;
  8.  
  9. class MyArea : GLArea {
  10.     bool render (GLContext c, GLArea a)
  11.     {
  12.         makeCurrent();
  13.         glClearColor(1,0,0,1);
  14.         glClear(GL_COLOR_BUFFER_BIT);      
  15.         return true;
  16.     }  
  17. }
  18. class ExampleWindow : MainWindow
  19. {  
  20.     this()
  21.     {
  22.         super("GtkD: Try");
  23.  
  24.         MyArea glarea = new MyArea();
  25.         glarea.addOnRender(&glarea.render);
  26.         add(glarea);
  27.         showAll();
  28.     }
  29. }
  30.  
  31. void main(string[] arg)
  32. {
  33.     DerelictGL3.load();
  34.     Main.init(arg);
  35.     new ExampleWindow();   
  36.     Main.run();
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement