wxGLCanvas docs say "Please use the constructor with wxGLAttributes (not implemented in wx) instead."

Hi All,

I’m deep in the throes of working in Elixir with 3D in OpenGL via the Erlang wx bindings. .I’m happily rendering teapots but I’m struggling to get a depth buffer working properly on the canvas.

Depth buffers are configured when the canvas is set up. Currently I have (Elixir module attributes with int values for the GL constants):

      attrib_list = [@wx_gl_rgba, @wx_gl_doublebuffer, @wx_gl_depth_size, 16, 0]
      gl_canvas = :wxGLCanvas.new(frame, [{:attribList, attrib_list}])

wx is not very happy with the attributes and I can’t create the canvas.

When I refer to the wxCanvas Documentation [Erlang -- wxGLCanvas] it says:

To set up the attributes for the canvas (number of bits for the depth buffer, number of bits for the stencil buffer and so on) you pass them in the constructor using a wxGLAttributes (not implemented in wx) instance. You can still use the way before 3.1.0 (setting up the correct values of the attribList parameter) but it’s discouraged.

The docs repeat several times that this method of calling new is deprecated and I should use the version that takes a wxGLAttributes argument along with the “(not implemented in wx)” qualification. This documentation has been the same since OTP 24.

I thought this might mean it’s part of another Erlang library but I cannot find any documentation or examples of wxGLAttributes in Erlang or its use in creating canvases. I’m not really sure what to do. It seems the only way to create a canvas is deprecated and it raises errors when I try to set attributes. Any pointers would be greatly appreciated :-).

Regards,
Robin

Both the API and documentation is generated, so things can be improved :slight_smile:

That means that using wx can require some investigation and trail and error sometimes.

In this case that means that the wxWidgets people want to you use wxGLAttributes class
which I have not implemented in wx yet.

But the list variants have worked my usage of it see for example:

1 Like

Hi Dan,

Thanks very much for your help, and thanks for your efforts with Wings3D and the wx OpenGL bindings over the years. Here’s my meager initial contribution to graphics programming on the BEAM:

I borrowed your uniform helper functions directly, and I’m going to keep other helper functions minimal so that the correspondence with examples in other languages remains clear. For now I’m going to be porting more of the Learn OpenGL exercises over to Elixir and learning as I go.

Cheers,
Robin

2 Likes