Skip to content

Commit

Permalink
fix tests + last depwarns
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonDanisch committed Jun 29, 2018
1 parent 868fc7c commit 629acc6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
10 changes: 6 additions & 4 deletions src/ModernGL.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
__precompile__(true)
module ModernGL

using Libdl

function glXGetProcAddress(glFuncName)
ccall((:glXGetProcAddress, "libGL.so.1"), Ptr{Cvoid}, (Ptr{UInt8},), glFuncName)
end
Expand All @@ -18,12 +20,12 @@ function wglGetProcAddress(glFuncName)
ccall((:wglGetProcAddress, "opengl32"), Ptr{Cvoid}, (Ptr{UInt8},), glFuncName)
end

if is_apple()
if Sys.isapple()
getprocaddress(glFuncName) = NSGetProcAddress(glFuncName)
elseif is_unix()
elseif Sys.isunix()
getprocaddress(glFuncName) = glXGetProcAddress(glFuncName)
end
if is_windows()
if Sys.iswindows()
getprocaddress(glFuncName) = wglGetProcAddress(glFuncName)
end

Expand Down Expand Up @@ -76,7 +78,7 @@ macro GenEnums(list)
name::Symbol
end
$(dictname) = $enumdict1
function $(enumName){T}(number::T)
function $(enumName)(number::T) where T
if !haskey($(dictname), number)
error("$number is not a GLenum")
end
Expand Down
6 changes: 3 additions & 3 deletions src/functionloading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ macro glfunc(opengl_func)
func_name_str = string(func_name)
ptr_expr = :(getprocaddress_e($func_name_str))

if is_windows() # windows has some function pointers statically available and some not, this is how we deal with it:
if Sys.iswindows() # windows has some function pointers statically available and some not, this is how we deal with it:
ptr = Libdl.dlsym_e(gl_lib, func_name)
if (ptr != C_NULL)
ptr_expr = :(($func_name_sym, "opengl32"))
Expand All @@ -42,10 +42,10 @@ macro glfunc(opengl_func)
end
return esc(ret)
end
if is_windows()
if Sys.iswindows()
const gl_lib = Libdl.dlopen("opengl32")
end
include("glFunctions.jl")
if is_windows()
if Sys.iswindows()
Libdl.dlclose(gl_lib)
end
14 changes: 7 additions & 7 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ if !is_ci() # only do test if not CI... this is for automated testing environmen
println(createcontextinfo())
# The data for our triangle
data = GLfloat[
0.0, 0.5,
0.5, -0.5,
-0.5,-0.5
0.0, 0.5,
0.5, -0.5,
-0.5,-0.5
]
# Generate a vertex array and array buffer for our data
vao = glGenVertexArray()
Expand All @@ -37,15 +37,15 @@ if !is_ci() # only do test if not CI... this is for automated testing environmen
const vsh = """
$(get_glsl_version_string())
in vec2 position;
Cvoid main() {
gl_Position = vec4(position, 0.0, 1.0);
void main() {
gl_Position = vec4(position, 0.0, 1.0);
}
"""
const fsh = """
$(get_glsl_version_string())
out vec4 outColor;
Cvoid main() {
outColor = vec4(1.0, 1.0, 1.0, 1.0);
void main() {
outColor = vec4(1.0, 1.0, 1.0, 1.0);
}
"""
vertexShader = createShader(vsh, GL_VERTEX_SHADER)
Expand Down

0 comments on commit 629acc6

Please sign in to comment.