Skip to content
This repository has been archived by the owner on Dec 2, 2019. It is now read-only.

demo/glfw_opengl3 Remove global state #760

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

maddouri
Copy link

@maddouri maddouri commented Oct 21, 2018

Hi,

Its great that Nuklear doesn't depend on globals.
However, some of the demos do. This could be a problem if we want to create multiple windows with their own, separate states/contexts. (e.g. #451)

This PR is an attempt to get rid of the global state for the glfw_opengl3 demo.

EDIT: I forgot to mention that:

  1. I have also fixed what appears to be a typo:
    • nk_gflw3_scroll_callback() -> nk_glfw3_scroll_callback()
  2. I could remove the global state from other GLFW demos if this PR is accepted

* Embedd the GLFW state structure as a user pointer in the window
* For the callbacks, point to the GLFW state using nk_handle.ptr
* This should prevent segfaults when compiling w/ -O2
  and defining INCLUDE_ALL
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant