Skip to content
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

Use LocalPreferences.toml to use system level libEGL by default for linux systems #16

Closed
arhik opened this issue Nov 14, 2023 · 32 comments
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@arhik
Copy link
Member

arhik commented Nov 14, 2023

No description provided.

@arhik arhik converted this from a draft issue Nov 14, 2023
@arhik arhik added bug Something isn't working help wanted Extra attention is needed labels Nov 14, 2023
@arhik
Copy link
Member Author

arhik commented Nov 14, 2023

@VarLad came up with this option. Now we have to figure out how to ship this solution that works on all Linux-systems.

@arhik
Copy link
Member Author

arhik commented Nov 14, 2023

Preferences.jl looks interesting.

@arhik arhik moved this from Todo to In Progress in Linux EGL issue Nov 14, 2023
@arhik
Copy link
Member Author

arhik commented Nov 14, 2023

Used Libdl and Prefererences.jl library to make this work. Reference to commit in WGPUCanvas library here.

JuliaWGPU/WGPUCanvas.jl@e8c859d

@arhik
Copy link
Member Author

arhik commented Nov 16, 2023

Fixed here

@arhik
Copy link
Member Author

arhik commented Nov 16, 2023

slack discussion is going on this approach.

@arhik
Copy link
Member Author

arhik commented Nov 18, 2023

WGPUCanvas.jl is registered with this fix JuliaRegistries/General#95352

@arhik
Copy link
Member Author

arhik commented Nov 18, 2023

We can close this once anyone confirms that this is indeed fixed.

@arhik arhik moved this from In Progress to Done in Linux EGL issue Nov 26, 2023
@arhik arhik moved this from Done to In Progress in Linux EGL issue Nov 26, 2023
@VarLad
Copy link
Member

VarLad commented Mar 4, 2024

@arhik Apologies, I'm running into the same issue again (it crashes with GLFW loaded)
I believe that the examples need to be updated to use WGPUCanvas.jl instead of directly GLFW.jl?

@VarLad
Copy link
Member

VarLad commented Mar 5, 2024

I was able to get the cube example running (using the hack I wrote).
I'm guessing that the examples have to be updated to use WGPUCanvas.jl instead of GLFW.jl?
@arhik Correct me if I'm wrong of this

@arhik
Copy link
Member Author

arhik commented Mar 5, 2024

May be you are not placing LocalPreferences.toml file in global folder. I am placing it in the julia dev folder (like ~/.julia/environment). Yes. On linux I had to manually create LocalPreferences.toml file like you suggested and it works but I wish it can be automated. I will have to dig into it. Anyways check your configuration and let me know.

@arhik
Copy link
Member Author

arhik commented Mar 5, 2024

By the way all examples in the GUI must be flipped vertically if you are using the master branch; I made few changes while working on gaussian splatting code.

@VarLad
Copy link
Member

VarLad commented Mar 5, 2024

@arhik The LocalPreferences.jl file worked but I'm asking if instead of directly using GLFW.jl, does it make more sense to use WGPUCanvas instead?
Seems like its function is to reduce boilerplate of working with WGPU + GLFW :P

@arhik
Copy link
Member Author

arhik commented Mar 5, 2024

Yes totally. A little more abstraction with WGPUCanvas will help. If we don't have to use these in examples like these

using GLFW
using GLFW: WindowShouldClose, PollEvents, DestroyWindow

with abstracted functions defined in WGPUCanvas would be great.

@arhik
Copy link
Member Author

arhik commented Mar 5, 2024

I am not happy with too much clutter of duplicate includes too. I see your point.

@VarLad
Copy link
Member

VarLad commented Mar 5, 2024

@arhik Is there any examples of WGPUCanvas.jl in action?

@arhik
Copy link
Member Author

arhik commented Mar 5, 2024

I am not following. Can you rephrase or expand on it?

@arhik
Copy link
Member Author

arhik commented Mar 5, 2024

All examples use WGPUCanvas. WGPUgfx loads WGPUCanvas. And its WGPUCanvas's job to load appropriate surface based on platform.

@arhik
Copy link
Member Author

arhik commented Mar 5, 2024

If I misunderstood your question correct me please.

@arhik
Copy link
Member Author

arhik commented Mar 5, 2024

It doesn't look like it but in WGPUCanvas we provide getCanvas through WGPUCore definitions.

canvas = WGPUCore.getCanvas(:GLFW)

@arhik
Copy link
Member Author

arhik commented Mar 5, 2024

@VarLad
Copy link
Member

VarLad commented Mar 5, 2024

@arhik Ah, sorry, I thought WGPUCanvas acted as a replacement for directly using GLFW 😅
Didn't see that it was imported and used by WGPUgfx

By the way, were you able to figure out why the libglvnd provided by BinaryBuilder gives issues here?

@arhik
Copy link
Member Author

arhik commented Mar 5, 2024

No. But its a prevalent Symbol collision issue.

@VarLad
Copy link
Member

VarLad commented Mar 5, 2024

@arhik I'm interested in helping to get the circle example working.
I guess I need to work on the circle primitive first. I believe that would be a good starting point for contribution as well.

Can you give me some directions towards this?

@arhik
Copy link
Member Author

arhik commented Mar 5, 2024

UI circle example should help. Divide circle into triangle primitive. Within triangle primitive, you only need two sides as a template unit (i.e three vertices). You will have rotate these three vertices with 360/n degrees ( n - no of divisions) n times. All these already part of ui/circle.jl.

https://github.com/JuliaWGPU/WGPUgfx.jl/blob/main/src/ui/circle.jl

@arhik
Copy link
Member Author

arhik commented Mar 5, 2024

Basically you should return a Circle object with indexData, vertexData, colorData and normalData (optional)

@VarLad
Copy link
Member

VarLad commented Mar 5, 2024

@arhik Is there any example that deals with 2D shapes?

@arhik
Copy link
Member Author

arhik commented Mar 5, 2024

tri.jl and plane.jl is simplest.

https://github.com/JuliaWGPU/WGPUgfx.jl/blob/main/examples/plane.jl

These are actually 2D objects in 3D world. If you are asking for strictly 2D object restricted to image plane then look into ui/quad.jl. Its mostly copy paste of plane.jl except z-values are forced to zero and camera is not included in the generated in wgsl code.

@VarLad
Copy link
Member

VarLad commented Mar 6, 2024

@arhik Thanks, that was really helpful.
Do you have an example which shows working with mouse or keypresses?

@arhik
Copy link
Member Author

arhik commented Mar 6, 2024

splat.jl should be listening to both mouse events and keypresses. No visual aid for key pressess. That would interesting project.

For splat.jl to work you will have to download a file from here https://drive.google.com/drive/folders/1B8fBd3ivh1OuJBY_P28woJfmzvWc8WlO

@VarLad
Copy link
Member

VarLad commented Mar 6, 2024

@arhik I looked at the specific example (splat.jl) but I can't seem to find the specific lines that seem to be listening to keypresses or mouse movements.
Is there a way to print them to screen?

@arhik
Copy link
Member Author

arhik commented Mar 6, 2024

key - 'a' for attaching event system and 'd' for detaching event system. You should see mouse pointer output and key events in the terminal window.

@arhik
Copy link
Member Author

arhik commented Mar 6, 2024

Look into events.jl files in both WGPUCanvas and WGPUgfx. Basically WGPUCanvas provides hooks which WGPUgfx will hook into and overwrite event output. In detached mode you will have all events printed out in terminal. WGPUgfx override events with no print statements.

@arhik arhik closed this as completed Mar 8, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in Linux EGL issue Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
Status: Done
Development

No branches or pull requests

2 participants