Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Embedded RenderWindow depth buffer issues on linux  (Read 2877 times)

0 Members and 1 Guest are viewing this topic.

sirjuddington

  • Newbie
  • *
  • Posts: 13
    • View Profile
Embedded RenderWindow depth buffer issues on linux
« on: December 09, 2019, 12:53:11 am »
I'm having problems getting SFML to create a RenderWindow with a valid depth buffer on linux, using the constructor that takes an existing window handle (it's being embedded in a wxWidgets application).

No matter what context settings I request, it will always create a context without a depth buffer. It seems to work fine when creating a RenderWindow on its own via the other constructor (the one that takes a VideoMode etc.)

The code I'm using to create the window can be found here.

It works fine in Windows (not macOS, but then I've never been able to get it to work at all there), it just seems to be a linux issue. It's also nothing to do with the graphics driver as I am getting the issue on both an intel iris integrated gpu and an nvidia gtx 970.

I get the following output when it tries to create the context:
Code: [Select]
Warning: The created OpenGL context does not fully meet the settings that were requested
Requested: version = 1.0 ; depth bits = 24 ; stencil bits = 8 ; AA level = 0 ; core = false ; debug = false ; sRGB = false
Created: version = 3.0 ; depth bits = 0 ; stencil bits = 0 ; AA level = 0 ; core = false ; debug = false ; sRGB = false

Any ideas what it might be?

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Embedded RenderWindow depth buffer issues on linux
« Reply #1 on: December 09, 2019, 02:12:28 am »
In the Linux Xlib world, the pixel/surface format of the window can only be set when creating the window. It cannot be retroactively changed. Since you create your window using wxWidgets you will have to get wxWidgets to create a window with the correct format and pass it to SFML. The context settings parameter for the window handle overload is more or less meaningless on Linux, it is there because of the other platforms where retroactively changing the pixel format is possible.

You should still be using wxGLCanvas even when intending to render with SFML. The normal wxControl object doesn't know much about OpenGL surface attributes.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

sirjuddington

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Embedded RenderWindow depth buffer issues on linux
« Reply #2 on: December 09, 2019, 02:59:48 am »
Ah ok that makes sense. Looks like it all works correctly now. Thanks :)

Perhaps a note could be added to the documentation for that constructor noting that the context settings are ignored on linux? It's a pretty niche case I know but might be helpful to others.