ModernGL.jl icon indicating copy to clipboard operation
ModernGL.jl copied to clipboard

[DO NOT MERGE] Test Clang.jl's generator

Open Gnimuc opened this issue 3 years ago • 3 comments
trafficstars

As per https://github.com/JuliaGL/ModernGL.jl/pull/71#discussion_r787914912

Gnimuc avatar Jan 24 '22 05:01 Gnimuc

~~TODO List:~~ (What I can do at the moment is to merely provide this demo.)

  1. Need to find a way to ship gl.h. Maybe we can create a new JLL package like what we did for VulkanCore.jl: https://github.com/JuliaBinaryWrappers/Vulkan_Headers_jll.jl
  2. Function pointer loading. Can we just use "libGL.so.1" etc. in ccall directly instead of querying those function pointers with these helpers? https://github.com/JuliaGL/ModernGL.jl/blob/master/src/ModernGL.jl

Gnimuc avatar Jan 24 '22 05:01 Gnimuc

Can we just use "libGL.so.1" etc. in ccall directly instead of querying those function pointers with these helpers?

Pretty sure we can't.. To be fair, my memory is a bit hazy about the details, since I dived into this (almost) centuries ago. But what I remember is, that it may work with some drivers, but is absolutely not guaranteed. It's also somewhat impossible to work - e.g. think of hybrid GPU platforms, where one can switch the GPU from intel to amd dynamically - pretty sure that kind of stuff already requires us to always ask for the current pointers of the OpenGL implementation.

SimonDanisch avatar Jan 25 '22 11:01 SimonDanisch

I can successfully render triangles with this PR on macOS. This method is doable but still needs someone to add support to generate extra expressions for Windows and debug mode. Also, this PR uses CEnum.jl which will be a breaking change.

Gnimuc avatar Jan 25 '22 12:01 Gnimuc