Hello,

We are using wxPerl for the Slic3r software for 3d printing
http://www.slic3r.org

Would you please consider extending the Alien::Wx and Wx::GLCanvas packages
to support the OpenGL Multi Sample Anti Aliasing? My crude patches are
attached. It works for me and it is a sufficient solution to our customers
right now, but I am a rookie with Perl, so it is likely not a clean
solution.

The wxWidgets 3.0.3 is in a beta stage right now. The wxWidgets maintainers
claim, that the wxWidgets 3.1.0 are already in a better shape. Would you
please consider extending wxPerl to wxWidgets 3.1.0? I tried, but they seem
to break some backward compatibility and as I am not very familiar with
Perl and XS, I gave up on that myself as long as 3.0.3-beta fits my needs.

By the way, the code snippet to initialize the multi sample anti aliased
context in Slic3r looks like this. It is so complex to keep the code
compatible with and without the patched wxWidgets & Wx::GLCanvas.

    # We can only enable multi sample anti aliasing wih wxWidgets 3.0.3 and
with a hacked Wx::GLCanvas,
    # which exports some new WX_GL_XXX constants, namely
WX_GL_SAMPLE_BUFFERS and WX_GL_SAMPLES.
    my $can_multisample =
        Wx::wxVERSION >= 3.000003 &&
        defined Wx::GLCanvas->can('WX_GL_SAMPLE_BUFFERS') &&
        defined Wx::GLCanvas->can('WX_GL_SAMPLES');
    my $attrib = [WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_DEPTH_SIZE, 24];
    if ($can_multisample) {
        # Request a window with multi sampled anti aliasing. This is a new
feature in Wx 3.0.3 (backported from 3.1.0).
        # Use eval to avoid compilation, if the subs WX_GL_SAMPLE_BUFFERS
and WX_GL_SAMPLES are missing.
        eval 'push(@$attrib, (WX_GL_SAMPLE_BUFFERS, 1, WX_GL_SAMPLES, 4));';
    }
    # wxWidgets expect the attrib list to be ended by zero.
    push(@$attrib, 0);

    # we request a depth buffer explicitely because it looks like it's not
created by
    # default on Linux, causing transparency issues
    my $self = $class->SUPER::new($parent, -1, Wx::wxDefaultPosition,
Wx::wxDefaultSize, 0, "", $attrib);
    if (Wx::wxVERSION >= 3.000003) {
        # Wx 3.0.3 contains an ugly hack to support some advanced OpenGL
attributes through the attribute list.
        # The attribute list is transferred between the wxGLCanvas and
wxGLContext constructors using a single static array s_wglContextAttribs.
        # Immediatelly force creation of the OpenGL context to consume the
static variable s_wglContextAttribs.
        $self->GetContext();
    }


Thanks, Vojtech

Attachment: Alien-wxWidgets-0.67-wx3.0.3-beta.patch
Description: Binary data

Attachment: Wx-GLCanvas-0.09-wx3.0.3-MSAA.patch
Description: Binary data

Reply via email to