-
Notifications
You must be signed in to change notification settings - Fork 35
Added GLFW specific functionality from GLWindow.jl #118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Made it so MonitorProperties doesn't depend on GeometryTypes, I think for performance its ok. If something constructs it without using the constructor there might be some trouble in current implementations
jayschwa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reorganizing files makes it hard to review the functional changes. Please do either one or the other in this PR.
For file reorganization, I think it makes more sense to group things by functionality (e.g. context, input, window, etc) rather than by kind (e.g. functions, types, constants). http://www.glfw.org/docs/latest/modules.html groups API names by functionality and can probably inform a reorg.
|
I agree on functionality over "kind". Wouldn't this create a lot of very small files? |
|
Thanks for dialing back the file reorg. It will make the other changes easier to digest. |
src/glfw3.jl
Outdated
| props = MonitorProperties(GetPrimaryMonitor()) | ||
| w,h = props.videomode.width, props.videomode.height | ||
| # Vec(Int(w),Int(h)) | ||
| Vector([Int(w),Int(h)]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just return (Int(w), Int(h))
This should keep previous functionality without depending on GeometryTypes, with the same performace as well
jayschwa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the ceremony from changing window properties and including saner defaults seems good. Some of the other additions aren't obvious wins to me, so I requested removal. I'm open to having them added in future PRs where they can be debated.
If this gets merged, I'll probably still tweak things a bit before cutting a new release.
src/glfw3.jl
Outdated
| @@ -1,4 +1,4 @@ | |||
| #************************************************************************ | |||
| ************************************************************************ | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix comment by re-adding #.
src/glfw3.jl
Outdated
|
|
||
| function poll_glfw() | ||
| PollEvents() | ||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this function. It is not adding value.
src/glfw3.jl
Outdated
| Integer: The number of the Monitor to Select | ||
| Bool: if true, primary monitor gets fullscreen, false no fullscren (default) | ||
| GLFW.Monitor: Fullscreens on the passed monitor | ||
| """ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this function. It appears to be unused.
src/glfw3.jl
Outdated
| KEY_UP == b && return :up | ||
| end | ||
| return :nothing | ||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this function. It appears to be unused.
src/glfw3.jl
Outdated
|
|
||
| MakeContextCurrent(window) | ||
|
|
||
| debugging && glDebugMessageCallbackARB(_openglerrorcallback, C_NULL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
glDebugMessageCallbackARB appears to be undefined. This line might need to be removed.
src/glfw3.jl
Outdated
| window.handle == C_NULL && return | ||
| SwapBuffers(window) | ||
| return | ||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this function. It's not adding enough value in my opinion.
src/glfw3.jl
Outdated
| (Symbol(last(split(string(f),"."))), f(window)) | ||
| end | ||
| Dict{Symbol, Any}(tmp) | ||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this function (for now). I think it's a little too magical.
src/glfw3.jl
Outdated
|
|
||
| function Base.resize!(x::Window, w::Integer, h::Integer) | ||
| SetWindowSize(x, w, h) | ||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this function (for now). The documented description of resize! is for collections, so using it here seems a bit off. The alternative (calling SetWindowSize) isn't any longer.
src/glfw3.jl
Outdated
| function Base.isopen(window::Window) | ||
| window.handle == C_NULL && return false | ||
| !WindowShouldClose(window) | ||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this function (for now). "is open" and "should not close" are two different concepts in my opinion, and the alternative can still be done in one line.
I agree on all of the comments. Some of the functions aren't used/belong somewhere else like you correctly assessed! I will make sure to pay more attention to these things in the future.
|
I'm not against any tweaking on your part I'm sure you know better what to do with this package than I do. If you want I can also delete all the annotations I made, like where blocks of code originated from. |
jayschwa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few changes requested. The annotations don't need to be removed. I like seeing where they came from. Once tests are green, I'll merge and take it from there.
| @@ -1,2 +1,3 @@ | |||
| deps/* | |||
| !deps/build.jl | |||
|
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this new line.
src/glfw3.jl
Outdated
| Base.show(io::IO, m::Monitor) = write(io, "Monitor($(m.handle == C_NULL ? m.handle : GetMonitorName(m)))") | ||
|
|
||
| const WindowHandle = Ptr{Void} | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this new line.
| Base.showerror(io::IO, e::GLFWError) = print(io, "GLFWError ($(e.code)): ", e.description) | ||
|
|
||
| #Came from GLWindow.jl/types.jl | ||
| struct MonitorProperties |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change struct to immutable for Julia 0.5 compatibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
Also, not sure if you care, but GitHub is setting your name to "Unknown" as the author. I believe that can be changed under GitHub settings. |
|
Merged via #122. Thanks for the contribution! |
|
Very Good, thanks to you too! |
glfw3.jltofunctions.jlglfw3.jltotypes.jlglfw3.jltoconstants.jlgl_createcontextout ofGLWindow.jl/screen.jlto a constructor forWindow.Windowrelated functionality fromGLWindow.jl/screen.jl,types.jl,core.jltotypes.jl.MonitorPropertiesfromGLWindow.jl/types.jltotypes.jlMonitorPropertiesso it doesn't depend onGeometryTypes: Vechit in performance shouldn't matter imo.GLFW.jlrelated functionality fromGLWindow/screen.jl,core.jltoextensions.jlTests work, also ran the tests for the pullrequest in
GLWindow.jlGeneral Idea: Firstly, splitting pure
GLFW.jlrelated functionality fromGLWindow.jlwill allow it to be less backend specific, and act as a interface to differentOpenGLwindow/context providers. This is in light of hopefully seperating Windowing functionality in 'GLWindow' fromGLAbstraction.jland provide more of anAPIexperience.Secondly, I understand this makes the package no-longer a barebones wrap around the
GLFWlibrary, but was it really purely that to begin with, and would people not use the added functionality that only depends onGLFWif it is there?