-
Notifications
You must be signed in to change notification settings - Fork 25
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
Is there a way to use the gr framework with CImGui.jl? #37
Comments
yadmtr
changed the title
Is there a way to use the gr framework with CImGui.jl
Is there a way to use the gr framework with CImGui.jl?
Jan 22, 2021
If you're talking about how to use GR as a backend for CImGui.jl, then it is possible as long as GR exposes its OpenGL context and a callback function for hacking into its rendering loop. You might also be interested in the following post: |
Thanks this post was what I needed. using GRUtils
using Printf
ENV["GKS_WSTYPE"] = "100" # off-screen rendering
y = rand(1001)
img_width, img_height = 400, 400
image = rand(GLuint, 4, img_width, img_height) # allocate the memory
GRUtils.colorscheme("LIGHT")
fg = GRUtils.plot( y)
str_pointer = Printf.@sprintf("%p",pointer(image))
filename = Printf.@sprintf("!%dx%d@%s.mem", img_width, img_height,str_pointer[3:end])
GC.@preserve image savefig(filename, fg) # write an image directly to memory as 32-bit RGBA
...
# creat texture for image drawing
image_id = ImGui_ImplOpenGL3_CreateImageTexture(img_width, img_height)
# show image
CImGui.Begin("Image Demo")
ImGui_ImplOpenGL3_UpdateImageTexture(image_id, image, img_width, img_height)
CImGui.Image(Ptr{Cvoid}(image_id), (img_width, img_height))
CImGui.End()
... |
This was referenced Jan 24, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there a way to use the gr framework (or GRUtils) with CImGui.jl ?
The text was updated successfully, but these errors were encountered: