shartrec
(Trevor Campbell)
October 21, 2023, 10:45am
1
I am drawing a map of the world, but can’t get the Depth Testing to work. I have
unsafe {
gl::Enable(gl::DEPTH_TEST);
gl::Enable(gl::LINE_SMOOTH);
gl::DepthFunc(gl::LESS);
gl::DepthMask(gl::TRUE);
gl::ClearColor(0.26, 0.19, 0.31, 1.);
gl::Clear(gl::COLOR_BUFFER_BIT | gl::DEPTH_BUFFER_BIT);
}
But When I draw, first an opaque sphere and then the global coastlines, I see both sides of the world showing. I expect just to see the near side.
jfrancis
(Jason Francis)
October 21, 2023, 3:59pm
2
GTK does not use a depth buffer, you must allocate one and ensure it is attached before rendering. Edit: Also see the comment by ebassi below for a much easier way to do that.
ebassi
(Emmanuele Bassi)
October 21, 2023, 5:03pm
3
Have you called set_has_depth_buffer(true)
on the GLArea widget?
shartrec
(Trevor Campbell)
October 21, 2023, 10:25pm
4
Hi @ebassi ,
Thanks
set_has_depth_buffer(true)
Works perfectly.
1 Like
system
(system)
Closed
November 20, 2023, 10:26pm
5
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.