Skip to content
This repository has been archived by the owner on Apr 28, 2021. It is now read-only.

Removed deprecations to get Plots with glvisualize backend running in #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
julia 0.6
julia 0.7

Reactive 0.5.2
GLAbstraction 0.5
Expand Down
4 changes: 2 additions & 2 deletions src/callbacks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This is why there is also framebuffer_size.
returns `Signal{Vec{2,Int}}`
[GLFW Docs](http://www.glfw.org/docs/latest/group__window.html#gaaca1c2715759d03da9834eac19323d4a)
"""
function window_size(window, s::Signal{Vec{2,Int}}=Signal(Vec{2,Int}(GLFW.GetWindowSize(window))))
function window_size(window, s::Signal{Vec{2,Int}}=Signal(Vec{2,Int}(GLFW.GetWindowSize(window)...)))
GLFW.SetWindowSizeCallback(window, (window, w::Cint, h::Cint,) -> begin
push!(s, Vec{2,Int}(w, h))
end)
Expand All @@ -26,7 +26,7 @@ Size of window in pixel.
returns `Signal{Vec{2,Int}}`
[GLFW Docs](http://www.glfw.org/docs/latest/group__window.html#ga311bb32e578aa240b6464af494debffc)
"""
function framebuffer_size(window, s::Signal{Vec{2, Int}}=Signal(Vec{2, Int}(GLFW.GetFramebufferSize(window))))
function framebuffer_size(window, s::Signal{Vec{2, Int}}=Signal(Vec{2, Int}(GLFW.GetFramebufferSize(window)...)))
GLFW.SetFramebufferSizeCallback(window, (window, w::Cint, h::Cint) -> begin
push!(s, Vec(Int(w), Int(h)))
end)
Expand Down
15 changes: 8 additions & 7 deletions src/screen.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function openglerrorcallback(
source::GLenum, typ::GLenum,
id::GLuint, severity::GLenum,
length::GLsizei, message::Ptr{GLchar},
userParam::Ptr{Void}
userParam::Ptr{Nothing}
)
errormessage = """
________________________________________________________________
Expand All @@ -21,9 +21,9 @@ function openglerrorcallback(
nothing
end

global const _openglerrorcallback = cfunction(
openglerrorcallback, Void,
(GLenum, GLenum,GLuint, GLenum, GLsizei, Ptr{GLchar}, Ptr{Void})
global const _openglerrorcallback = @cfunction(
openglerrorcallback, Nothing,
(GLenum, GLenum,GLuint, GLenum, GLsizei, Ptr{GLchar}, Ptr{Nothing})
)


Expand Down Expand Up @@ -78,7 +78,7 @@ function scaling_factor(window::Vec{2, Int}, fb::Vec{2, Int})
end
function scaling_factor(nw)
w, fb = GLFW.GetWindowSize(nw), GLFW.GetFramebufferSize(nw)
scaling_factor(Vec{2, Int}(w), Vec{2, Int}(fb))
scaling_factor(Vec{2, Int}(w...), Vec{2, Int}(fb...))
end

"""
Expand Down Expand Up @@ -203,7 +203,7 @@ function create_glcontext(
GLFW.WindowHint(wh[1], wh[2])
end

@static if is_apple()
@static if Sys.isapple()
if debugging
warn("OpenGL debug message callback not available on osx")
debugging = false
Expand Down Expand Up @@ -579,12 +579,13 @@ function Base.push!(screen::Screen, robj::RenderObject{Pre}) where Pre
index = findfirst(getfield(screen, sym)) do renderlist
prerendertype(eltype(renderlist)) == Pre
end
if index == 0
if (index == 0) || (index == nothing)
# add new specialised renderlist, if none found
setfield!(screen, sym, (getfield(screen, sym)..., RenderObject{Pre}[]))
index = length(getfield(screen, sym))
end
# only add to renderlist if not already in there
tmp = getfield(screen, sym)[index]
in(robj, getfield(screen, sym)[index]) || push!(getfield(screen, sym)[index], robj)
nothing
end
4 changes: 2 additions & 2 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ function MonitorProperties(monitor::Monitor)
position = Vec{2, Int}(GLFW.GetMonitorPos(monitor)...)
physicalsize = Vec{2, Int}(GLFW.GetMonitorPhysicalSize(monitor)...)
videomode = GLFW.GetVideoMode(monitor)
sfactor = is_apple() ? 2.0 : 1.0
sfactor = Sys.isapple() ? 2.0 : 1.0
dpi = Vec(videomode.width * 25.4, videomode.height * 25.4) * sfactor ./ Vec{2, Float64}(physicalsize)
videomode_supported = GLFW.GetVideoModes(monitor)

Expand Down Expand Up @@ -210,7 +210,7 @@ mutable struct Screen
function Screen(
name ::Symbol,
area ::Signal{SimpleRectangle{Int}},
parent ::Union{Screen, Void},
parent ::Union{Screen, Nothing},
children ::Vector{Screen},
inputs ::Dict{Symbol, Any},
renderlist ::Tuple,
Expand Down
3 changes: 2 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ function is_ci()
end

using GLWindow
using Base.Test
using Test
using GLFW

if !is_ci() # only do test if not CI... this is for automated testing environments which fail for OpenGL stuff, but I'd like to test if at least including works

Expand Down