Retina display for OpenGL

84 views
Skip to first unread message

Kshitij Sachan

unread,
Aug 1, 2019, 9:36:07 AM8/1/19
to Racket Users
I've set up an OpenGL context that is displayed in a snip (I chose a snip because I want to be able to move the camera around and generally respond to user input). However, I've noticed that the OpenGL context in Racket looks considerably worse than when I run the same OpenGL code in C++ (the racket code is actually calling a C library function using the FFI).

I believe this is because the Racket snip isn't able to take advantage of the Retina display on my Mac. Is this the correct reason, and if so, is there any way to fix this and make the quality better?

Kshitij Sachan

unread,
Aug 1, 2019, 9:52:42 AM8/1/19
to Racket Users
Here is some more information about how I get the OpenGL context.

First, I make a bitmap using `make-gl-bitmap`. Then, I make a bitmap-dc% object that contains my glbitmap and get its gl-context% object using `get-gl-context`.

Mark Warren

unread,
Aug 1, 2019, 10:02:35 AM8/1/19
to Racket Users
I've never used this before so I may be completely wrong, but you can supply gl-config% to the make-gl-bitmap and there is a method on it 

(send a-gl-config set-hires-mode hires-mode)

That may be what you need.

Kshitij Sachan

unread,
Aug 1, 2019, 10:33:20 AM8/1/19
to Racket Users
That looked so promising! Unfortunately I just tried it, and nothing changed. :(

Mark Warren

unread,
Aug 1, 2019, 10:39:22 AM8/1/19
to Racket Users
That's a shame, I'm afraid I'm out of ideas then. Hopefully someone else will know.


On Thursday, 1 August 2019 14:36:07 UTC+1, Kshitij Sachan wrote:

Jay McCarthy

unread,
Aug 3, 2019, 1:44:10 PM8/3/19
to Mark Warren, Racket Users
There's two steps to using the hires mode on OS X.

First, you need the OpenGL configuration to be in hires-mode.

Second, you need to set the viewport in your OpenGL code to the result
of `get-gl-client-size`, not `get-scaled-client-size` or
`get-client-size`, which are all very similarly sounding functions.

--
Jay McCarthy
Associate Professor @ CS @ UMass Lowell
http://jeapostrophe.github.io
Vincit qui se vincit.


--
Jay McCarthy
Associate Professor @ CS @ UMass Lowell
http://jeapostrophe.github.io
Vincit qui se vincit.
> --
> You received this message because you are subscribed to the Google Groups "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to racket-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/0452ca69-81f7-45e0-9718-3ca95a42ce68%40googlegroups.com.

Kshitij Sachan

unread,
Aug 6, 2019, 9:13:02 PM8/6/19
to Racket Users
It looks like `get-gl-client-size` is meant for canvas objects. Is there a parallel function or any other way to get high resolution snips?


On Saturday, August 3, 2019 at 1:44:10 PM UTC-4, Jay McCarthy wrote:
There's two steps to using the hires mode on OS X.

First, you need the OpenGL configuration to be in hires-mode.

Second, you need to set the viewport in your OpenGL code to the result
of `get-gl-client-size`, not `get-scaled-client-size` or
`get-client-size`, which are all very similarly sounding functions.

--
Jay McCarthy
Associate Professor @ CS @ UMass Lowell
http://jeapostrophe.github.io
Vincit qui se vincit.


--
Jay McCarthy
Associate Professor @ CS @ UMass Lowell
http://jeapostrophe.github.io
Vincit qui se vincit.


On Thu, Aug 1, 2019 at 10:39 AM 'Mark Warren' via Racket Users
<racket...@googlegroups.com> wrote:
>
> That's a shame, I'm afraid I'm out of ideas then. Hopefully someone else will know.
>
> On Thursday, 1 August 2019 14:36:07 UTC+1, Kshitij Sachan wrote:
>>
>> I've set up an OpenGL context that is displayed in a snip (I chose a snip because I want to be able to move the camera around and generally respond to user input). However, I've noticed that the OpenGL context in Racket looks considerably worse than when I run the same OpenGL code in C++ (the racket code is actually calling a C library function using the FFI).
>>
>> I believe this is because the Racket snip isn't able to take advantage of the Retina display on my Mac. Is this the correct reason, and if so, is there any way to fix this and make the quality better?
>
> --
> You received this message because you are subscribed to the Google Groups "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to racket...@googlegroups.com.

Thomas Dickerson

unread,
Aug 14, 2019, 3:13:59 PM8/14/19
to Racket Users
It seems like the issue here is not with the OpenGL setup, but with figuring out whether or not the draw context passed to a snip supports high-resolution drawing.
Presumably the answer is "yes" somewhere in the pipeline, since the font rendering in the REPL doesn't look noticeably worse than the font rendering in my menu bar.
The question is what plumbing needs to be established in between to make use of it (or whether or not the plumbing is there to begin with).
Reply all
Reply to author
Forward
0 new messages