AlexCharlton / cl-glfw3

Common Lisp bindings to GLFW version 3.x
BSD 2-Clause "Simplified" License
89 stars 32 forks source link

GL crashes when using version 4 #31

Closed aodhneine closed 5 years ago

aodhneine commented 5 years ago

I am trying to run simple example and I want to use OpenGL version 4. However, when I set :context-version-major 4 in with-window, GL crashes. I have GLFW 3.3 installed.

Code which I'm running:

(defun main ()
  (glfw:with-init
    (glfw:with-window (:width 640 :height 480 :title "CL-GLFW3"
                       :context-version-major 4)
      (setf %gl:*gl-get-proc-address* #'glfw:get-proc-address)
      (gl:clear-color 0 0.5 1 1)
      (loop until (glfw:window-should-close-p)
            do ((lambda ()
                  (gl:clear :color-buffer)
                  (gl:color 1 1 1 1)
                  (gl:rect 0 0 1 1)))
            do (glfw:swap-buffers)
            do (glfw:poll-events)))))

Error report:

debugger invoked on a CL-OPENGL-BINDINGS:OPENGL-ERROR in thread
#<THREAD "main thread" RUNNING {10004F04C3}>:
  OpenGL signalled (1282 . INVALID-OPERATION) from COLOR-4F.

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [CONTINUE] Continue
  1: [ABORT   ] Exit debugger, returning to top level.

(CL-OPENGL-BINDINGS:CHECK-ERROR #<unavailable argument>)
   source: (RESTART-CASE (ERROR 'OPENGL-ERROR :ERROR-CODE
                                (CONS ERROR-CODE
                                      (CFFI:FOREIGN-ENUM-KEYWORD
                                       'CL-OPENGL-BINDINGS:ENUM ERROR-CODE))
                                :ERROR-CONTEXT CONTEXT)
             (CONTINUE NIL :REPORT "Continue"))
remexre commented 5 years ago

Well, glColor was removed from OpenGL 4...

aodhneine commented 5 years ago

Yes, stupid me. Never checked if I'm using existing functions. After removing this it works, so not an issue. Closing.