borodust / bodge-nuklear

Thin wrapper over Nuklear for Common Lisp
MIT License
62 stars 11 forks source link

Failed to create GLFW window #4

Open Le-Brut opened 4 years ago

Le-Brut commented 4 years ago

Hi! I am trying to run the example

(ql:quickload :bodge-nuklear/example)
(nuklear.example:run)

but I get this error:

This is SBCL 2.0.3, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
* (ql:quickload :bodge-nuklear/example)
To load "bodge-nuklear/example":
  Load 1 ASDF system:
    bodge-nuklear/example
; Loading "bodge-nuklear/example"
.........
(:BODGE-NUKLEAR/EXAMPLE)
* (nuklear.example:run)
Unhandled error:
Failed to create GLFW window
debugger invoked on a SIMPLE-CONDITION in thread
#<THREAD "main thread" RUNNING {1000508083}>:
  Failed to create GLFW window

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

restarts (invokable by number or by possibly-abbreviated name):
  0: [CONTINUE] Return from BREAK.
  1: [STOP    ] Stop the task.
  2: [ABORT   ] Abort the task.
  3: [UNBLOCK ] Leave the task running and unblock this thread.
  4:            Exit debugger, returning to top level.

(CLUTZ::MAIN #<NUKLEAR.EXAMPLE::NUKLEAR-APP {1004F8D253}>)
   source: (ERROR "Failed to create GLFW window")
0]

Interestingly enough, running the bodge-glfw example

(ql:quickload :bodge-glfw/example)
(glfw.example:run)

works just fine (opens an empty hello world window).

Here are the versions of both bodge-glfw and bodge-nuklear, as found in ~/quicklisp:

./dists/quicklisp/software/bodge-glfw-stable-7519a922-git
./dists/quicklisp/software/bodge-nuklear-stable-16f52766-git

I am running on Arch Linux.

What could be the problem here?

borodust commented 4 years ago

Nuklear renderer uses certain OpenGL version. Do you have video driver installed and configured? What that reports:

glxinfo | grep OpenGL
Le-Brut commented 4 years ago

glxinfo | grep OpenGL

OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) HD Graphics (ILK)
OpenGL version string: 2.1 Mesa 20.0.4
OpenGL shading language version string: 1.20
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 2.0 Mesa 20.0.4
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 1.0.16
OpenGL ES profile extensions:

BTW I am able to compile and run Nuklear/demo/sdl_opengl2 and Nuklear/demo/glfw_opengl2.

borodust commented 4 years ago

Try to change :opengl-version from (3 3) to (2 1) in src/example.lisp

borodust commented 4 years ago

On the second thought, this is unlikely to work, because native renderer used in the example is using OpenGL 3.

Le-Brut commented 4 years ago

@borodust Changed it, recompiled, but, yeah, same error indeed.

borodust commented 4 years ago

If you want to see how Nukear might look like in Common Lisp, instead of running example from this library, check out https://github.com/borodust/bodge-ui-window

;; Add cl-bodge distribution into quicklisp
(ql-dist:install-dist "http://bodge.borodust.org/dist/org.borodust.bodge.txt" :replace t :prompt nil)

;; Update main dist just in case
(ql:update-dist "quicklisp")

;; Eenable OpenGL 2 renderer
(cl:pushnew :bodge-gl2 cl:*features*)

;; Load the example
(ql:quickload :bodge-ui-window/examples)
;; And run it!
(bodge-ui-window.example.basic:run)

bodge-ui-window indirectly uses this library to display UI. It employs a different renderer though and supports both OpenGL2 and OpenGL3.

Le-Brut commented 4 years ago

@borodust this one works! Thank you!