Advertisement
pib

LuaJIT code exhibiting black window

pib
May 11th, 2011
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.77 KB | None | 0 0
  1. local ffi = require( "ffi" )
  2. ffi.cdef[[
  3. enum { GLFW_WINDOWED = 0x00010001 };
  4. typedef struct _GLFWwindow* GLFWwindow;
  5. int glfwInit( void );
  6. GLFWwindow  glfwOpenWindow( int width, int height, int mode, const char* title, GLFWwindow share );
  7. void glfwSwapBuffers( void );
  8. ]]
  9.  
  10. ffi.cdef[[
  11. enum { GL_COLOR_BUFFER_BIT = 0x00004000 };
  12. typedef unsigned int GLbitfield;
  13. typedef float GLclampf;
  14. void glClear (GLbitfield mask);
  15. void glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
  16. ]]
  17.  
  18. glfw = ffi.load('./libglfw.so')
  19. gl = ffi.load('libGL.so')
  20.  
  21. glfw.glfwInit()
  22. win = glfw.glfwOpenWindow(640, 480, glfw.GLFW_WINDOWED, 'testing', nil)
  23.  
  24. gl.glClearColor(1, 1, 1, 0)
  25. while true do
  26.    gl.glClear(gl.GL_COLOR_BUFFER_BIT)
  27.    glfw.glfwSwapBuffers()
  28. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement