Git Product home page Git Product logo

glabstraction.jl's People

Contributors

alainlich avatar dpsanders avatar femtocleaner[bot] avatar jingpengw avatar juliatagbot avatar kwonoh avatar levskaya avatar louisponet avatar musm avatar programmeroftheeve avatar shashi avatar simondanisch avatar sjkelly avatar timholy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

glabstraction.jl's Issues

Failure to add package in Julia 1.0.1

  Updating registry at `~/.julia/registries/General`
  Updating git-repo `https://github.com/JuliaRegistries/General.git`
 Resolving package versions...
ERROR: Unsatisfiable requirements detected for package GLAbstraction [ca6e7d0a]:
 GLAbstraction [ca6e7d0a] log:
 ├─possible versions are: [0.0.2-0.0.14, 0.1.0, 0.2.0-0.2.1, 0.3.0-0.3.2, 0.5.0-0.5.1, 0.6.0-0.6.2] or uninstalled
 ├─restricted to versions * by an explicit requirement, leaving only versions [0.0.2-0.0.14, 0.1.0, 0.2.0-0.2.1, 0.3.0-0.3.2, 0.5.0-0.5.1, 0.6.0-0.6.2]
 └─restricted by julia compatibility requirements to versions: uninstalled — no versions left

UndefVarError: ContextNotAvailable not defined

@SimonDanisch I'm getting an error due to ContextNotAvailable not being defined upon trying to use GLAbstraction (Which i need for GLFW & GLWindow). Looking around I didn't find that type being defined anywhere and since the change was made two days ago (97a39b5) i might be the first one running into this issue:

julia> using GLAbstraction
INFO: Precompiling module GLAbstraction...
ERROR: LoadError: LoadError: UndefVarError: ContextNotAvailable not defined
 in include at boot.jl:260
 in include_from_node1 at loading.jl:392
 in include at boot.jl:260
 in include_from_node1 at loading.jl:392
 [inlined code] from boot.jl:263
 in anonymous at no file:0
 in eval at boot.jl:263
 [inlined code] from sysimg.jl:14
 in process_options at client.jl:254
 in _start at client.jl:377
while loading C:\Users\necka\.julia\v0.5\GLAbstraction\src\GLTypes.jl, in expression starting on line 288
while loading C:\Users\necka\.julia\v0.5\GLAbstraction\src\GLAbstraction.jl, in expression starting on line 57
ERROR: Failed to precompile GLAbstraction to C:\Users\necka\.julia\lib\v0.5\GLAbstraction.ji
 in error at error.jl:21

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

Warnings in current Julia head

I get this warning with a Julia nightly build, in gluniform.

WARNING: [a] concatenation is deprecated; use [a;] instead
 in depwarn at /opt/software/Julia-0.4.0-dev-32aee08d0b.app/Contents/Resources/julia/lib/julia/sys.dylib
 in oldstyle_vcat_warning at /opt/software/Julia-0.4.0-dev-32aee08d0b.app/Contents/Resources/julia/lib/julia/sys.dylib
 in gluniform at no file
 in ***

I'm not sure where it's coming from.

Fails to precompile on Julia 0.6

Importing GLAbstraction in Julia 0.6 results in the following error:

INFO: 
Precompiling module GLAbstraction.
WARNING: could not import Base.call into GLAbstraction
WARNING: both GeometryTypes and FixedSizeArrays export "Mat"; uses of it in module GLAbstraction must be qualified
ERROR: LoadError: LoadError: 
UndefVarError: Mat not defined
Stacktrace:
 [1] 
include_from_node1(::String) at .\loading.jl:539
 [2] include(::String) at .\sysimg.jl:14
 [3] include_from_node1(::String) at .\loading.jl:539
 [4] include(::String) at .\sysimg.jl:14
 [5] anonymous at .\<missing>:2
while loading C:\Users\alexe_000\.julia\v0.6\GLAbstraction\src\composition.jl, in expression starting on line 76
while loading C:\Users\alexe_000\.julia\v0.6\GLAbstraction\src\GLAbstraction.jl, in expression starting on line 57

Tested on the master branches of GLAbstraction, GeometryTypes and FixedSizeArrays

Loading shader from file results in LazyShader error

Loading tutorials/tranformations1.jl results in

julia> include("transformations1.jl")
ERROR: LoadError: Please supply only paths or tuples of (source, typ) for Lazy Shader
            Found: (("#version 150\n\nin vec2 position;\nin vec3 color;\nin vec2 texcoord;\n\nout vec3 Color;\nout vec2 Texcoord;\n\nuniform mat4 trans;\n\nvoid main()\n{\n    Color = color;\n    Texcoord = texcoord;\n    gl_Position = trans*vec4(position, 0.0, 1.0);\n}\n", 0x00008b31), GL_FRAGMENT_SHADER shader: C:\Users\stephan\.julia\v0.6\GLAbstraction\tutorials\shaders\puppykitten.frag)
source:
1   : # version 150
2   :
3   : in vec3 Color;
4   : in vec2 Texcoord;
5   :
6   : out vec4 outColor;
7   :
8   : uniform sampler2D texKitten;
9   : uniform sampler2D texPuppy;
10  :
11  : void main()
12  : {
13  :     vec4 colKitten = texture(texKitten, Texcoord);
14  :     vec4 colPuppy  = texture(texPuppy,  Texcoord);
15  :     outColor = mix(colKitten, colPuppy, 0.5);
16  : }
17  :
)
Stacktrace:
 [1] gl_convert(::GLAbstraction.LazyShader, ::Dict{Symbol,Any}) at C:\Users\stephan\.julia\v0.6\GLAbstraction\src\GLShader.jl:251
 [2] GLAbstraction.RenderObject(::Dict{Symbol,Any}, ::GLAbstraction.LazyShader, ::GLAbstraction.StandardPrerender, ::Void, ::Reactive.Signal{GeometryTypes.HyperRectangle{3,Float32}}, ::Void) at C:\Users\stephan\.julia\v0.6\GLAbstraction\src\GLTypes.jl:309
 [3] std_renderobject at C:\Users\stephan\.julia\v0.6\GLAbstraction\src\GLRenderObject.jl:111 [inlined]
 [4] std_renderobject(::Dict{Symbol,Any}, ::GLAbstraction.LazyShader) at C:\Users\stephan\.julia\v0.6\GLAbstraction\src\GLRenderObject.jl:110
 [5] include_from_node1(::String) at .\loading.jl:576
 [6] include(::String) at .\sysimg.jl:14
while loading C:\Users\stephan\.julia\v0.6\GLAbstraction\tutorials\transformations1.jl, in expression starting on line 65

Copying the fragment shader directly into the source file works fine.

(Note: There's also the problem that Face doesn't take three parameters (anymore), so one needs to change Face{3,UInt32,-1} on line 28 of transformations.jl)

I'm using
GLAbstraction 0.5.1
julia 0.6.1
on Windows 10 & MacOS

Camera Documentation

@kleinash asked:

Is there an API or somewhere I can find info on the args of PerspectiveCamera? Specifically for theta, translation, zoom, FOV and clip distances. I know my understanding is not up to scratch because translation and eyeposition seem similar, along with eyeposition and translation, zoom and FOV etc.. Basically I am just confusing myself with what needs to go where and ending up with a blank image render. 

https://github.com/JuliaGL/GLAbstraction.jl/blob/master/src/GLCamera.jl

That's pretty much the setup of the camera:

FOV(Field of View) and clip distances form the viewing frustrum.
Zoom, translation and theta are just helper to implement a camera that is movable with the mouse.
It just get's converted into lookat, eyeposition, upvector, which is all you need to describe a camera.
Theta rotates around the three camera axis (up, left, (lookat-eyeposition).
I'll soon create documentations, where I'll fill in these kind of information.

Best,
Simon

gluniform is unsafe with 4x4 matrices of incorrect type

If you use orthographicprojection, it returns a Float64 matrix, but a shader might expect a GLfloat matrix, not GLdouble, so that gluniform seems to pass a pointer to a matrix of the wrong type to glUniform. This can silently break shaders by setting uniform parameters to unexpected values.

I think maybe gluniform could accept GLProgram and a symbol naming the uniform, instead of the integer for its location, so that it could check the argument type.

glTexImage 2D: width too large. Width: 256

I started getting the following. Reverting GLText 1 commit fixes it.

glTexImage 2D: width too large. Width: 256
while loading In[2], in expression starting on line 10

in glTexImage at /Users/solver/.julia/v0.3/GLAbstraction/src/GLExtendedFunctions.jl:162
in Texture at /Users/solver/.julia/v0.3/GLAbstraction/src/GLTexture.jl:61
in Texture at /Users/solver/.julia/v0.3/GLAbstraction/src/GLTexture.jl:209
in Texture at /Users/solver/.julia/v0.3/GLAbstraction/src/GLTexture.jl:228
in Texture at /Users/solver/.julia/v0.3/GLAbstraction/src/GLTexture.jl:252
in GLFont at /Users/solver/.julia/v0.3/GLText/src/types.jl:95
in inittext at /Users/solver/.julia/v0.3/GLText/src/GLText.jl:15
in init_glutils at /Users/solver/.julia/v0.3/GLAbstraction/src/GLInit.jl:12
in createwindow at /Users/solver/.julia/v0.3/GLWindow/src/reactglfw.jl:401
in createdisplay at /Users/solver/.julia/v0.3/GLPlot/src/GLPlot.jl:51
in glsurf at /Users/solver/.julia/v0.3/ApproxFun/src/Plot/GLPlot.jl:57
in surf at /Users/solver/.julia/v0.3/ApproxFun/src/Plot/Plot.jl:78
in plot at /Users/solver/.julia/v0.3/ApproxFun/src/Plot/Plot.jl:191
in timeevolution at /Users/solver/.julia/v0.3/ApproxFun/src/Extras/show.jl:141

Improve Camera

  • Fix JuliaGL/GLVisualize.jl#10
  • Introduce units for the view matrix
  • make it possible to switch between orthographic and perspective projection
  • make it easy to put 2D objects on the pixel perfect plane
  • make it simpler to switch between different modi to control the camera (first person, lookat, etc)
  • think about if it would make sense to include more window like functionality into the camera (frame rate, render target, etc)

Just to keep you up to date, @rohitvarkey, @shashi, @sjkelly

Pkg.test fails on FreeBSD with Julia 0.5.0

I can't tell if this is a problem with GLAbstraction or with FileIO:

julia> Pkg.test("GLAbstraction")
INFO: Computing test dependencies for GLAbstraction...
INFO: No packages to install, update or remove
INFO: Testing GLAbstraction
ERROR: LoadError: MethodError: Cannot convert an object of type FileIO.File{FileIO.DataFormat{:GLSLShader}} to an object of type GLAbstraction.Shader
This may have arisen from a call to the constructor GLAbstraction.Shader(...),
since type constructors fall back to convert methods.
in load(::FileIO.File{FileIO.DataFormat{:GLSLShader}}) at /usr/home/ko/.julia/v0.5/GLAbstraction/src/GLShader.jl:77
in #load#13(::Array{Any,1}, ::Function, ::String) at /usr/home/ko/.julia/v0.5/FileIO/src/loadsave.jl:45
in macro expansion; at /usr/home/ko/.julia/v0.5/GLAbstraction/test/runtests.jl:34 [inlined]
in anonymous at ./:?
in _init at /usr/local/lib/julia/sys.so:? (repeats 5 times)
while loading /usr/home/ko/.julia/v0.5/GLAbstraction/test/runtests.jl, in expression starting on line 11

Nothing exported? [Julia v1.1]

Hey there, I'm running into an issue where using isn't pulling in the GLAbstraction exports.

Maybe it's a 1.1 incompatibility? Maybe user error on my end 😛 ?

I'm using GLAbstraction#master locally.

julia> versioninfo()
Julia Version 1.1.0
Commit 80516ca202 (2019-01-21 21:24 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i9-7900X CPU @ 3.30GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, skylake)

julia> using GLAbstraction

julia> Buffer()
ERROR: UndefVarError: Buffer not defined
Stacktrace:
 [1] top-level scope at none:0

julia> GLAbstraction.Buffer()
ERROR: MethodError: no method matching GLAbstraction.Buffer()
Closest candidates are:
  GLAbstraction.Buffer(::DenseArray{T<:Real,1}; buffertype, usage) where T<:Real at C:\Users\simon\.julia\packages\GLAbstraction\Z8nud\src\buffer.jl:24
  GLAbstraction.Buffer(::DenseArray{T,1}; buffertype, usage) where T at C:\Users\simon\.julia\packages\GLAbstraction\Z8nud\src\buffer.jl:30
  GLAbstraction.Buffer(::Type{T}, ::Int64; buffertype, usage) where T at C:\Users\simon\.julia\packages\GLAbstraction\Z8nud\src\buffer.jl:37
Stacktrace:
 [1] top-level scope at none:0

Thanks!

GLFW is missing in REQUIRE

GLFW is missing in REQUIRE

Please, see
GLAbstraction.jl:using GLFW
GLCamera.jl: left_ctrl = Set([GLFW.KEY_LEFT_CONTROL])

No Shader Update: GLShader.jl - isupdated()

System: Windows 8.1 (x64)
Julia: 0.4.0
tutorial: GLAbstraction.jl/tutorials/depth_stencils1.jl
shader: GLAbstraction.jl/tutorials/shaders/puppykitten_color.frag

When i modify a color in the shader it does not update the file or refresh the szene as expected. This could be a problem with Reactive. i posted the issue here: JuliaGizmos/Reactive.jl#84.

Does Everyone else has this problem too?

ERROR: UndefVarError: switch_context! not defined

Dear all,

I get the error: ERROR: UndefVarError: switch_context! not defined

when I input the line:
GLAbstraction.switch_context!(window)

and indeed I do not find anywhere the function... could you point me out to where this could be found?

How to dynamically update a texture?

I'm not sure if this is the place to post "how do I..." type questions, but I wasn't able to find any kind of user forum, so please point me onwards if I'm in the wrong place.

I'm hoping I can use this package for the relatively simple task of displaying a simple 2D grid-based simulation in real time as it updates. I'd like to use OpenGL for this because then the display won't slow it down too much and I can easily zoom and pan around etc. To do this, I need to either dynamically update a texture, or create a new one each frame.

Starting with the tutorial at https://github.com/JuliaGL/GLAbstraction.jl/blob/master/tutorials/textures1.jl, I tried creating a new Texture object and calling std_renderobject again on each iteration. This works, but it seems quite slow, and makes me wonder if this is the right way to do it. However, I was unable to find any documentation suggesting whether these objects can be dynamically updated without creating new ones every time.

My apologies if this is a dumb question. I'm not at all an OpenGL expert, and would greatly appreciate a simple explanation or even just an example of the best way to dynamically update a texture (from a cpu-based Julia array), if that can be done in this package.

Examples fail to run because shader string macros do not compile

When I attempt to run any of the examples provided with the package, they generate an error at the first nonstandard string literal defining vertex shaders. E.g., in simple_triangle.jl, line 6:

const vsh = vert"""
{{GLSL_VERSION}}
in vec2 position;

void main(){
	gl_Position = vec4(position, 0, 1.0);
}
"""

It looks like the @vert_str macro doesn't try to parse the {{GLSL_VERSION}} template value, and possibly this could be fixed just by using LazyShader instead of Shader in the macro, but I'm not clear if the template values were intended for shader program files only or also for the string literals.

segfault on finalizer

Unfortunately I can't reproduce this and don't have much extra debugging info. It happened after creating a couple of scenes in Makie.jl, then opening the doc browser in Juno. I'm guessing that opening the doc browser triggered a GC pass, which triggered the backtrace below.

signal (11): Segmentation fault
while loading no file, in expression starting on line 0
unknown function (ip: 0x7f1d3451f448)
free at /home/sfr/.julia/v0.6/GLAbstraction/src/GLTypes.jl:374
unknown function (ip: 0x7f1d2cd73b62)
jl_call_fptr_internal at /buildworker/worker/package_linux64/build/src/julia_internal.h:339 [inlined]
jl_call_method_internal at /buildworker/worker/package_linux64/build/src/julia_internal.h:358 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:1926
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1424 [inlined]
run_finalizer at /buildworker/worker/package_linux64/build/src/gc.c:111
jl_gc_run_finalizers_in_list at /buildworker/worker/package_linux64/build/src/gc.c:200
run_finalizers at /buildworker/worker/package_linux64/build/src/gc.c:234 [inlined]
jl_gc_collect at /buildworker/worker/package_linux64/build/src/gc.c:2112
jl_gc_pool_alloc at /buildworker/worker/package_linux64/build/src/gc.c:919

Cannot precompile with Julia v0.6.3

using GLAbstraction leads to error

julia> using GLAbstraction
INFO: Precompiling module GLAbstraction.
ERROR: LoadError: LoadError: TypeError: UnionAll: expected Type, got Int64
Stacktrace:
 [1] include_from_node1(::String) at .\loading.jl:576
 [2] include(::String) at .\sysimg.jl:14
 [3] include_from_node1(::String) at .\loading.jl:576
 [4] include(::String) at .\sysimg.jl:14
 [5] anonymous at .\<missing>:2
while loading C:\Users\jr\.julia\v0.6\GLAbstraction\src\GLMatrixMath.jl, in expression starting on line 218
while loading C:\Users\jr\.julia\v0.6\GLAbstraction\src\GLAbstraction.jl, in expression starting on line 112
ERROR: Failed to precompile GLAbstraction to C:\Users\jr\.julia\lib\v0.6\GLAbstraction.ji.
Stacktrace:
 [1] compilecache(::String) at .\loading.jl:710
 [2] _require(::Symbol) at .\loading.jl:497
 [3] require(::Symbol) at .\loading.jl:405

versioninfo()

Julia Version 0.6.3
Commit d55cadc350* (2018-05-28 20:20 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i5-5300U CPU @ 2.30GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.9.1 (ORCJIT, broadwell)

Seg Fault on 64 bit Debian Jessie

I was trying to track down a segfault in GLVisualize and an identical one occurred in the tests for this package. I will update as I get more details, but I am curious if this is reproducible on other systems.

steve:~/.julia/v0.4/GLAbstraction(master)$ julia ./test/runtests.jl 

signal (11): Segmentation fault
glfwShowWindow at /home/steve/.julia/v0.4/GLFW/deps/usr64/lib/libglfw.so (unknown line)
ShowWindow at /home/steve/.julia/v0.4/GLFW/src/glfw3.jl:395
jlcall_ShowWindow_21548 at  (unknown line)
jl_apply_generic at /home/steve/Software/julia4/usr/bin/../lib/libjulia.so (unknown line)
anonymous at /home/steve/.julia/v0.4/GLAbstraction/test/runtests.jl:24
unknown function (ip: 0x7f599d92584b)
unknown function (ip: 0x7f599d92646c)
jl_load at /home/steve/Software/julia4/usr/bin/../lib/libjulia.so (unknown line)
include at ./boot.jl:261
jl_apply_generic at /home/steve/Software/julia4/usr/bin/../lib/libjulia.so (unknown line)
include_from_node1 at ./loading.jl:304
jl_apply_generic at /home/steve/Software/julia4/usr/bin/../lib/libjulia.so (unknown line)
process_options at ./client.jl:316
_start at ./client.jl:411
unknown function (ip: 0x7f599ac21129)
jl_apply_generic at /home/steve/Software/julia4/usr/bin/../lib/libjulia.so (unknown line)
unknown function (ip: 0x401a37)
unknown function (ip: 0x40163f)
__libc_start_main at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
unknown function (ip: 0x401685)
unknown function (ip: (nil))
Segmentation fault
Julia Version 0.4.1-pre+8
Commit 1bb7e10 (2015-10-10 07:57 UTC)
Platform Info:
  System: Linux (x86_64-linux-gnu)
  CPU: Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.3

Info about upcoming removal of packages in the General registry

As described in https://discourse.julialang.org/t/ann-plans-for-removing-packages-that-do-not-yet-support-1-0-from-the-general-registry/ we are planning on removing packages that do not support 1.0 from the General registry. This package has been detected to not support 1.0 and is thus slated to be removed. The removal of packages from the registry will happen approximately a month after this issue is open.

To transition to the new Pkg system using Project.toml, see https://github.com/JuliaRegistries/Registrator.jl#transitioning-from-require-to-projecttoml.
To then tag a new version of the package, see https://github.com/JuliaRegistries/Registrator.jl#via-the-github-app.

If you believe this package has erroneously been detected as not supporting 1.0 or have any other questions, don't hesitate to discuss it here or in the thread linked at the top of this post.

ERROR: MethodError: no method matching shadertype...

I use to call Makie from my laptop under ubuntu.
Since yesterday I encounter the strange following error.
Any suggestion? Thanks!

julia> Makie.Scene(resolution = (500, 500))
Error showing value of type Scene:
ERROR: MethodError: no method matching shadertype(::FileIO.File{FileIO.DataFormat{:UNKNOWN},String})
Closest candidates are:
  shadertype(::GLMakie.GLAbstraction.Shader) at /root/.julia/packages/GLMakie/Pway1/src/GLAbstraction/GLShader.jl:63
  shadertype(::FileIO.File{FileIO.DataFormat{:GLSLShader},Name} where Name) at /root/.julia/packages/GLMakie/Pway1/src/GLAbstraction/GLShader.jl:64
  shadertype(::AbstractString) at /root/.julia/packages/GLMakie/Pway1/src/GLAbstraction/GLShader.jl:67
Stacktrace:
 [1] compile_shader(::String, ::String) at /root/.julia/packages/GLMakie/Pway1/src/GLAbstraction/GLShader.jl:145
 [2] (::GLMakie.GLAbstraction.var"#53#54"{String,Dict{String,String},Dict{Symbol,Any}})() at /root/.julia/packages/GLMakie/Pway1/src/GLAbstraction/GLShader.jl:170
 [3] get!(::GLMakie.GLAbstraction.var"#53#54"{String,Dict{String,String},Dict{Symbol,Any}}, ::Dict{String,Array{String,1}}, ::String) at ./dict.jl:450
 [4] get_template!(::String, ::Dict{String,String}, ::Dict{Symbol,Any}) at /root/.julia/packages/GLMakie/Pway1/src/GLAbstraction/GLShader.jl:162
 [5] gl_convert(::GLMakie.GLAbstraction.LazyShader, ::Dict{Symbol,Any}) at /root/.julia/packages/GLMakie/Pway1/src/GLAbstraction/GLShader.jl:250
 [6] GLMakie.GLAbstraction.RenderObject(::Dict{Symbol,Any}, ::GLMakie.GLAbstraction.LazyShader, ::GLMakie.PostprocessPrerender, ::Nothing, ::Observable{GeometryBasics.HyperRectangle{3,Float32}}, ::Nothing) at /root/.julia/packages/GLMakie/Pway1/src/GLAbstraction/GLTypes.jl:341
 [7] RenderObject at /root/.julia/packages/GLMakie/Pway1/src/GLAbstraction/GLTypes.jl:309 [inlined]
 [8] postprocess(::GLMakie.GLAbstraction.Texture{ColorTypes.RGBA{FixedPointNumbers.Normed{UInt8,8}},2}, ::GLMakie.GLAbstraction.Texture{Vec{4,Float32},2}, ::GLMakie.GLAbstraction.Texture{Vec{4,Float32},2}, ::GLMakie.GLAbstraction.Texture{Vec{2,Float32},2}, ::GLMakie.GLAbstraction.Texture{Vec{2,UInt32},2}, ::GLMakie.GLAbstraction.Texture{ColorTypes.RGBA{FixedPointNumbers.Normed{UInt8,8}},2}, ::Observable{Tuple{Int64,Int64}}) at /root/.julia/packages/GLMakie/Pway1/src/glwindow.jl:92
 [9] GLMakie.GLFramebuffer(::Tuple{Int64,Int64}) at /root/.julia/packages/GLMakie/Pway1/src/glwindow.jl:201
 [10] GLMakie.Screen(; resolution::Tuple{Int64,Int64}, visible::Bool, title::String, kw_args::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /root/.julia/packages/GLMakie/Pway1/src/screen.jl:333
 [11] Screen at /root/.julia/packages/GLMakie/Pway1/src/screen.jl:291 [inlined]
 [12] global_gl_screen at /root/.julia/packages/GLMakie/Pway1/src/screen.jl:363 [inlined]
 [13] global_gl_screen(::Tuple{Int64,Int64}, ::Bool, ::Int64) at /root/.julia/packages/GLMakie/Pway1/src/screen.jl:373
 [14] global_gl_screen at /root/.julia/packages/GLMakie/Pway1/src/screen.jl:372 [inlined]
 [15] backend_display at /root/.julia/packages/GLMakie/Pway1/src/gl_backend.jl:57 [inlined]
 [16] display(::AbstractPlotting.PlotDisplay, ::Scene) at /root/.julia/packages/AbstractPlotting/JCbJs/src/display.jl:45
 [17] display(::Any) at ./multimedia.jl:328
 [18] #invokelatest#1 at ./essentials.jl:710 [inlined]
 [19] invokelatest at ./essentials.jl:709 [inlined]
 [20] print_response(::IO, ::Any, ::Bool, ::Bool, ::Any) at /root/Julia/lib/julia-release-1.5/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:238
 [21] print_response(::REPL.AbstractREPL, ::Any, ::Bool, ::Bool) at /root/Julia/lib/julia-release-1.5/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:223
 [22] (::REPL.var"#do_respond#54"{Bool,Bool,REPL.var"#64#73"{REPL.LineEditREPL,REPL.REPLHistoryProvider},REPL.LineEditREPL,REPL.LineEdit.Prompt})(::Any, ::Any, ::Any) at /root/Julia/lib/julia-release-1.5/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:822
 [23] #invokelatest#1 at ./essentials.jl:710 [inlined]
 [24] invokelatest at ./essentials.jl:709 [inlined]
 [25] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /root/Julia/lib/julia-release-1.5/usr/share/julia/stdlib/v1.5/REPL/src/LineEdit.jl:2355
 [26] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at /root/Julia/lib/julia-release-1.5/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:1144
 [27] (::REPL.var"#38#42"{REPL.LineEditREPL,REPL.REPLBackendRef})() at ./task.jl:356

Improve Camera and move it to another package

Since I want to make GLVisualize independent of OpenGL, we also need to have the Camera be independent of GLAbstraction.
Also it would be desirable to remove as much Signals as possible to lower latency and secondary signals (map(x-> push!(y, x), Signal(...))).
I've create a prototype for a rectangular selection zoom camera, which needs to be integrated with the current default cameras.
Also it would be nice to have different camera control sets, e.g. optimized for text display, which the user can freely switch and configure.

Performance Roadmap

  • We need to unrole this loop for optimal performance
  • In the same loop, it would be great to diff against the previously rendered primitive, to reduce draw calls
  • even better: bake drawcalls for each program and move the entire loop to the GPU
  • Use one big buffer and distribute only views into that buffer

Use finalizers to garbage collect allocated opengl resources

It would be handy if functions that allocate opengl resources register a finalizer that will return the items ones they're no longer in scope.

I'm still pretty new to Julia, but perhaps something like the following (sorry for the javaisms I'm still learning, idea is the register a finalizer in the constructor for the buffer object).

type GLBuffer
idPtr::Ptr{GLuint}
id

function release()
if id != nothing then
glDeleteBuffers(1, idPtr)
id = nothing
end
end

function GLBuffer()
idPtr = GLuint[0]
glGenBuffers(1, idPtr)
glCheckError("calling glGenBuffers")
id = unsafe_load(idPtr)
finalize(this, release)
end

end

I'm guessing you can write

vbo = GLBuffer()
glBindBuffer(GL_ARRAY_BUFFER, vbo.id)

I've found this sort of thing is pretty useful in java and clojure opengl programs. The garbage collector is mostly good enough to clean up.

FrameBuffer, GLFramebuffer, scattered functionality... OpenGL package?

So I'm trying to implement the Weight blended OIT, as was mentioned by Simon in isosurface/transparency issue.

I'm really finding it hard to figure out all the components in the OpenGL related julia stack. There seem to be 3-5 packages which are so intertwined with each other (ModernGL.jl, GLFW.jl, GLWindow.jl, GLAbstraction.jl ), with similar stuff being defined throughout the three last ones, such as render(...) etc.

The most obvious place is the FrameBuffer type defined in GLAbstraction.jl and the GLFramebuffer in GLWindow.jl. It seems that the first one is not complete and is nowhere used.

This makes me wonder if it wouldn't be an option to group all the OpenGL packages together, in doing so maybe figure out what's useful/used, and what the best structure of the package might be. After all, this is supposed to be an API, i.e. understandable even without everything being documented minutely.

This would then mean that all the non-core stuff (with 'core' I don't mean boilerplate, I mean functionality around types like GLVertexArray, GLFramebuffer, etc) can be sifted out to kind of a middleware package which implements some often used, not directly 'API', functionality.

I wonder if this is something you agree on, and if you think this should be addressed.

Precompilation fails in Julia v0.5

I am up to date (at the commit aa686b8), however the GLAbstraction fails to precompile

  $ julia                                                                      
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.5.0-dev+1491 (2015-11-27 16:54 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit 41fb1ba (89 days old master)
|__/                   |  x86_64-linux-gnu

julia> using GLAbstraction
INFO: Precompiling module GLAbstraction...
 ERROR: LoadError: LoadError: UndefVarError: ContextNotAvailable not defined
 in include at ./boot.jl:260
 in include_from_node1 at ./loading.jl:392
 in include at ./boot.jl:260
 in include_from_node1 at ./loading.jl:392
 [inlined code] from boot.jl:263
 in anonymous at no file:0
 in eval at ./boot.jl:263
 [inlined code] from ./sysimg.jl:14
 in process_options at ./client.jl:254
 in _start at ./client.jl:377
while loading /home/blegat/.julia/v0.5/GLAbstraction/src/GLTypes.jl, in expression starting on line 300
while loading /home/blegat/.julia/v0.5/GLAbstraction/src/GLAbstraction.jl, in expression starting on line 57
ERROR: Failed to precompile GLAbstraction to /home/blegat/.julia/lib/v0.5/GLAbstraction.ji
 in error at ./error.jl:21
 in compilecache at loading.jl:471
 in require at ./loading.jl:339
 in eval at ./boot.jl:263

Static z-axis rotation

Sorry @SimonDanisch but this is a real stopper for me. The current view rotation settings are not useful and should frustrate any computational geometry person (see also: MakieOrg/Makie.jl#38, #76, #80, MakieOrg/Makie.jl#329).
It is not just a matter of a opinion/preference, the current convention is actually not useful and is hindering use of the package.

  1. The current convention differs from all CAD packages and stuff like Blender and MeshLab. Currently Makie feels like somebody inverted the controls on your bike (or it is like everybody is used to riding a Lagrangian bike and currently we need to switch to a Eulerian bike). You might say this is just a preference but still it makes sense to match the standard convention which has been tried and tested and feels most natural to most people. Here is a GIF showing the MeshLab system:
    Peek 2019-06-17 09-09_2

  2. My main objection to the current convention is that not all views are obtainable i.e. the rotation system does not allow all types of orientations. For instance I challenge you to use the current system to make the cat look to the right so we can look at its left flank (while the cat is still facing forward). See my attempt in this GIF
    Peek 2019-06-17 09-09

  3. When one continues to move the mouse in a single direction the direction of rotation should not change. Again if you look at the above GIF, if I move to cursor to the left the direction of rotation switches (perhaps something goes from 1 -> -1 or something after passing the middle?). The axis of rotation and angle should always be based on the cursor motion vector not location.

In short please please please implement the standard CAD convention.

transformations tutorial error

I tried to test transformations1.jl and 2.jl
julia transformations2.jl

there is no kitten.png and puppy.png.

WARNING: bytestring(p::Union{Ptr{Int8},Ptr{UInt8}}) is deprecated, use unsafe_string(p) instead.
 in depwarn(::String, ::Symbol) at ./deprecated.jl:64
 in bytestring(::Ptr{UInt8}) at ./deprecated.jl:50
 in error(::ImageMagick.MagickWand) at /usr/people/jingpeng/.julia/v0.5/ImageMagick/src/libmagickwand.jl:150
 in readimage(::ImageMagick.MagickWand, ::String) at /usr/people/jingpeng/.julia/v0.5/ImageMagick/src/libmagickwand.jl:231
 in #load_#14(::Type{T}, ::String, ::Bool, ::Function, ::String) at /usr/people/jingpeng/.julia/v0.5/ImageMagick/src/ImageMagick.jl:80
 in #load#7(::Array{Any,1}, ::Function, ::FileIO.File{FileIO.DataFormat{:PNG}}) at /usr/people/jingpeng/.julia/v0.5/ImageMagick/src/ImageMagick.jl:65
 in load(::FileIO.File{FileIO.DataFormat{:PNG}}) at /usr/people/jingpeng/.julia/v0.5/ImageMagick/src/ImageMagick.jl:65
 in #load#17(::Array{Any,1}, ::Function, ::FileIO.File{FileIO.DataFormat{:PNG}}) at /usr/people/jingpeng/.julia/v0.5/FileIO/src/loadsave.jl:85
 in load(::FileIO.File{FileIO.DataFormat{:PNG}}) at /usr/people/jingpeng/.julia/v0.5/FileIO/src/loadsave.jl:73
 in #load#13(::Array{Any,1}, ::Function, ::String) at /usr/people/jingpeng/.julia/v0.5/FileIO/src/loadsave.jl:45
 in load(::String) at /usr/people/jingpeng/.julia/v0.5/FileIO/src/loadsave.jl:45
 in include_from_node1(::String) at ./loading.jl:488
 in process_options(::Base.JLOptions) at ./client.jl:262
 in _start() at ./client.jl:318
while loading /usr/people/jingpeng/.julia/v0.5/GLAbstraction/tutorials/transformations2.jl, in expression starting on line 4
Error encountered while loading "/usr/people/jingpeng/.julia/v0.5/GLAbstraction/tutorials/images/kitten.png".
Fatal error:
ERROR: LoadError: unable to open file `/usr/people/jingpeng/.julia/v0.5/GLAbstraction/tutorials/images/kitten.png' @ error/png.c/ReadPNGImage/3667
 in error(::ImageMagick.MagickWand) at /usr/people/jingpeng/.julia/v0.5/ImageMagick/src/libmagickwand.jl:152
 in readimage(::ImageMagick.MagickWand, ::String) at /usr/people/jingpeng/.julia/v0.5/ImageMagick/src/libmagickwand.jl:231
 in #load_#14(::Type{T}, ::String, ::Bool, ::Function, ::String) at /usr/people/jingpeng/.julia/v0.5/ImageMagick/src/ImageMagick.jl:80
 in #load#7(::Array{Any,1}, ::Function, ::FileIO.File{FileIO.DataFormat{:PNG}}) at /usr/people/jingpeng/.julia/v0.5/ImageMagick/src/ImageMagick.jl:65
 in load(::FileIO.File{FileIO.DataFormat{:PNG}}) at /usr/people/jingpeng/.julia/v0.5/ImageMagick/src/ImageMagick.jl:65
 in #load#17(::Array{Any,1}, ::Function, ::FileIO.File{FileIO.DataFormat{:PNG}}) at /usr/people/jingpeng/.julia/v0.5/FileIO/src/loadsave.jl:85
 in load(::FileIO.File{FileIO.DataFormat{:PNG}}) at /usr/people/jingpeng/.julia/v0.5/FileIO/src/loadsave.jl:73
 in #load#13(::Array{Any,1}, ::Function, ::String) at /usr/people/jingpeng/.julia/v0.5/FileIO/src/loadsave.jl:45
 in load(::String) at /usr/people/jingpeng/.julia/v0.5/FileIO/src/loadsave.jl:45
 in include_from_node1(::String) at ./loading.jl:488
 in process_options(::Base.JLOptions) at ./client.jl:262
 in _start() at ./client.jl:318
while loading /usr/people/jingpeng/.julia/v0.5/GLAbstraction/tutorials/transformations2.jl, in expression starting on line 4

after copying two alternative images, I got a shader error.

julia transformations2.jl 
ERROR: LoadError: MethodError: Cannot `convert` an object of type FileIO.File{FileIO.DataFormat{:GLSLShader}} to an object of type GLAbstraction.Shader
This may have arisen from a call to the constructor GLAbstraction.Shader(...),
since type constructors fall back to convert methods.
 in load(::FileIO.File{FileIO.DataFormat{:GLSLShader}}) at /usr/people/jingpeng/.julia/v0.5/GLAbstraction/src/GLShader.jl:77
 in #load#13(::Array{Any,1}, ::Function, ::String) at /usr/people/jingpeng/.julia/v0.5/FileIO/src/loadsave.jl:45
 in load(::String) at /usr/people/jingpeng/.julia/v0.5/FileIO/src/loadsave.jl:45
 in include_from_node1(::String) at ./loading.jl:488
 in process_options(::Base.JLOptions) at ./client.jl:262
 in _start() at ./client.jl:318
while loading /usr/people/jingpeng/.julia/v0.5/GLAbstraction/tutorials/transformations2.jl, in expression starting on line 50

it seems that the Shader construction function for FileIO was not defined.
https://github.com/JuliaGL/GLAbstraction.jl/blob/master/src/GLShader.jl#L77

Geometry shaders are missing?

It seems geometry shaders are not yet implemented, and GLProgram seems to assume that only vertex and fragment shaders will be used. Since geometry shaders are optional, there should be a way to attach a geometry shader to a GLProgram without manipulating the GLProgram object by hand.

using pixel buffer objects

Hello I wan unable to find example usage of pixel buffer objects - in my case fast texture upload from CPU to GPU is priority so I tried to implement them but without success

simple code that works (for reference)

function updateTexture(data, textSpec::TextureSpec)
	glBindTexture(GL_TEXTURE_2D, textSpec.ID[]); 
	glTexSubImage2D(GL_TEXTURE_2D,0,0,0, textSpec.widthh, textSpec.heightt, GL_RED_INTEGER, textSpec.OpGlType, data);
end

code where I try to use pixel buffer objects - yet without success

First I define pixel buffers

preparePixelBufferStr="""
width -width of the image in  number of pixels 
height - height of the image in  number of pixels 
pboNumber - just states which PBO it is
return reference to the pixel buffer object that we use to upload this texture and data size calculated for this texture

"""
@doc preparePixelBufferStr
function preparePixelBuffer(juliaDataTyp::Type{juliaDataType},width,height,pboNumber)where{juliaDataType}
    DATA_SIZE = 8 * sizeof(juliaDataTyp) *width * height  # number of bytes our image will have so in 2D it will be width times height times number of bytes needed for used datatype we need to multiply by 8 becouse sizeof() return bytes instead of bits
    pbo = Ref(GLuint(pboNumber))  
    glGenBuffers(1, pbo)
    return (pbo,DATA_SIZE)
end

then

usePixelBuferAndUploadDataStr = """
adapted from http://www.songho.ca/opengl/gl_pbo.html
creates single pixel buffer of given type
pboID - id of the pixel buffer object that was prepared for some particular texture
textureId - reference to id of a texture that we want to bind to this PBO
juliaDataType -julia type that is representing datatype in 2 dimensional array representing ima
width -width of the image in  number of pixels 
height - height of the image in  number of pixels 
subImageDataType - variable used in glTexSubImage2D to tell open Glo what type of data is in texture
data one dimensional array o julia type and width*height length
DATA_SIZE - size of texture in bytes
"""
@doc usePixelBuferAndUploadDataStr
function usePixelBuferAndUploadData(
    juliaDataTyp::Type{juliaDataType}
                    ,pboID 
                    ,width
                    ,height
                    ,data
                    ,textureId
                    ,DATA_SIZE
                    ,subImageDataType = GL_SHORT
                
                    )where{juliaDataType}

    glBindTexture(GL_TEXTURE_2D,textureId[]); 
    # copy pixels from PBO to texture object
    # Use offset instead of pointer.
   # glTexSubImage2D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, GLsizei(width), GLsizei(height),  GL_RED_INTEGER, GL_SHORT, Ptr{juliaDataTyp}());
   
    glTexSubImage2D(GL_TEXTURE_2D,0,0,0, width, height, GL_RED_INTEGER, subImageDataType, Ptr{juliaDataType}());

  
    # bind the PBO
    glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pboID[]);


    # Note that glMapBuffer() causes sync issue.
    # If GPU is working with this buffer, glMapBuffer() will wait(stall)
    # until GPU to finish its job. To avoid waiting (idle), you can call
    # first glBufferData() with NULL pointer before glMapBuffer().
    # If you do that, the previous data in PBO will be discarded and
    # glMapBuffer() returns a new allocated pointer immediately
    # even if GPU is still working with the previous data.
    glBufferData(GL_PIXEL_UNPACK_BUFFER, DATA_SIZE, Ptr{juliaDataType}(), GL_STREAM_DRAW);
    
    # map the buffer object into client's memory
    glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY)
    
     
    ptr = Ptr{juliaDataType}(glMapBuffer(GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY))
    # update data directly on the mapped buffer - this is internal function implemented below
    
    updatePixels(ptr,data,length(data));

    glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER); # release the mapped buffer
    
    # it is good idea to release PBOs with ID 0 after use.
    # Once bound with 0, all pixel operations are back to normal ways.
    glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);



end
updatePixelsStr = """
adapted from https://github.com/JuliaPlots/GLMakie.jl/blob/2717d812fdc66b283f63d5d97237e8d69e2c1f25/src/GLAbstraction/GLBuffer.jl from unsafe copy
"""
@doc updatePixelsStr
function updatePixels(ptr, data,length)
    for i=1:length
        unsafe_store!(ptr,data[i], i)
    end
end

lastly

pboID,DATA_SIZE =preparePixelBuffer(Int16,512,512,1)
usePixelBuferAndUploadData( Int16, 512,512,data,textureId, DATA_SIZE,  GL_SHORT)

data is matrix of Int16's texture Id is that texture to which I want to pass data

So first I upload data of given type - I frequently use Int16 textures - then create pixel buffers - pass all to usePixelBuferAndUploadDataStr and then do simple rendering (just rendering onto the quad - swapping buffers… nothing fancy and as I said this part works)
Anybody have an idea How to make it work?

How to correctly use glGenBuffers()

I find these code in GLTypes.jl:

type GLBuffer{T <: Real, Cardinality}
    id::GLuint
    length::Int
    buffertype::GLenum
    usage::GLenum

    function GLBuffer(ptr::Ptr{T}, size::Int, buffertype::GLenum, usage::GLenum)
        @assert size % sizeof(T) == 0
        _length = div(size, sizeof(T))
        @assert _length % Cardinality == 0
        _length = div(_length, Cardinality)

--->    id = glGenBuffers()      # I don't know why this line could run correctly
        glBindBuffer(buffertype, id)
        glBufferData(buffertype, size, ptr, usage)
        glBindBuffer(buffertype, 0)

        obj = new(id, _length, buffertype, usage)
    end
end

but the only definition of glGenBuffer() in ModernGL.jl is

function glGenBuffers(n, buffers)
    ccall(@getFuncPointer("glGenBuffers"), Void, (GLsizei, Ptr{GLuint}), n, buffers)
end

Just got confused, if I run id = glGenBuffers(), a mismatching error will occur. Am I missing something?

Batch flushing data to GLBuffer

Is there a good way for me to flush a large array into a GLBuffer? Currently the setindex methods incur a huge amount of overhead for my purposes.

Context:
I'm rendering a bunch of arbitrarily colored squares on a window, and need to update the colors on every frame using data from a TCP socket connection. See the repo below for more info, not that it has much documentation at this point, but it's only about 100 lines of code)
https://github.com/JMurph2015/LEDSimulator.jl

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.