switchbrew / switch-examples

Switch examples for devkitA64 and libnx.
https://devkitpro.org/viewforum.php?f=42
559 stars 99 forks source link

EGL_SAMPLES support? #66

Closed niko1point0 closed 5 years ago

niko1point0 commented 5 years ago

Hi, I tried to edit some of the OpenGL tutorials to support anti aliasing.

In textured_cube/source/main.c, I tried changing this: static const EGLint framebufferAttributeList[] = { EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT, EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8, EGL_ALPHA_SIZE, 8, EGL_DEPTH_SIZE, 24, EGL_STENCIL_SIZE, 8, EGL_NONE };

To this static const EGLint framebufferAttributeList[] = { EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT, EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8, EGL_ALPHA_SIZE, 8, EGL_DEPTH_SIZE, 24, EGL_STENCIL_SIZE, 8,

    // MSAA?
EGL_SAMPLE_BUFFERS, 1,
EGL_SAMPLES, 4,

    EGL_NONE
};

I tried to compile and run the program, but the NRO simply crashed. Is the EGL_SAMPLES attribute supported?

fincs commented 5 years ago

The Switch's compositor does not support multisampled surfaces. As a replacement, you will have to manually create a separate GL (multisampled) framebuffer object and then blit that to the main framebuffer.

niko1point0 commented 5 years ago

Thank you