Opened 6 years ago

Closed 5 weeks ago

#15700 closed enhancement (fixed)

Retina support in wxGLCanvas

Reported by: koichi Owned by: Vadim Zeitlin <vadim@…>
Priority: low Milestone:
Component: wxOSX Version: dev-latest
Keywords: OpenGL Cc:
Blocked By: Blocking:
Patch: no

Description

I want to have native resolution support in wxGLCanvas in the case of using retina display.
https://developer.apple.com/library/mac/documentation/AppKit/Reference/NSViewOpenGLAdditions/Reference/Reference.html

I could somehow enabled it unconditionally by the attached patch, although it should not be enabled by default for backward compatibility.

I hope that someone can add an option to wxGLCanvas to optionally enable retina resolution.

Attachments (2)

window.patch download (475 bytes) - added by koichi 6 years ago.
Enable retina resolution in OpenGL canvas
glcanvas.patch download (459 bytes) - added by koichi 6 years ago.
Enable retina resolution in OpenGL canvas

Download all attachments as: .zip

Change History (11)

Changed 6 years ago by koichi

Enable retina resolution in OpenGL canvas

comment:1 Changed 6 years ago by vadz

  • Patch unset
  • Priority changed from normal to low
  • Status changed from new to confirmed

Should this be only done for wxGLCanvas or can it be useful to call this for other windows too?

comment:2 Changed 6 years ago by plorkyeran

It'd only be useful on other windows if you were using OpenGL without wxGLCanvas. There's no equivalent for non-OpenGL things; for everything else opting-in to retina support is done via a plist entry or simply supplying double-size images.

Changed 6 years ago by koichi

Enable retina resolution in OpenGL canvas

comment:3 Changed 6 years ago by koichi

Here is another attempt to (unconditionally) enable retina support.
It's now done in glcanvas.mm and other windows are not affected.

I also noticed that wxNSCustomOpenGLView is not used at all and wxGLCanvas seems to be using a general wxNSView.

comment:4 Changed 6 years ago by vadz

We could add a WX_GL_USE_BEST_RESOLUTION or something like that for use in the attribute list. Or just have a UseBestResolution(bool) method in wxGLCanvas which would do nothing on the other platforms.

comment:5 Changed 6 years ago by koichi

I rather prefer to add a flag than a new function.
In which file should the new style flag be defined?
I will create a patch!

comment:6 Changed 6 years ago by vadz

All the current flags are defined in source:wxWidgets/trunk/include/wx/glcanvas.h.

But thinking more about this, I think it could be a bad idea to make something that is not an OpenGL attribute appear as one. I don't see any practical drawbacks to it right now but this just seems like a wrong thing to do. So I'd prefer a method...

comment:7 Changed 6 years ago by koichi

I agree. Adding a flag that is not relevant to OpenGL attributes to the attrib parameter may be a bad idea. I was rather thinking of adding a new window style flag, similar to style flags that are relevant to specific subclass of wxWindow, e.g., wxTopLevelWindow.

On ABI level, adding a new flag has really no difference on platforms other than OSX, but adding a new function causes a tiny increase of ABI that is not useful at all on these platforms.
I know the difference is negligible. OK, maybe I am too nervous but whenever I have the two choices, I rather prefer the first choice.

How do you think?

comment:8 Changed 6 years ago by vadz

The only advantage of the flag I can see is that it would be possible to specify it in XRC. But as there is no XRC handler for wxGLCanvas at all currently, this doesn't seem significant.

OTOH a function is more clear, more extensible, easier to find in documentation and just more natural. So I'd do this.

comment:9 Changed 5 weeks ago by Vadim Zeitlin <vadim@…>

  • Owner set to Vadim Zeitlin <vadim@…>
  • Resolution set to fixed
  • Status changed from confirmed to closed

In f5d02e680/git-wxWidgets:

Enable Retina (HiDPI) support on OSX wxGLCanvas

Closes #15700.

Closes https://github.com/wxWidgets/wxWidgets/pull/1485

Note: See TracTickets for help on using tickets.