What's the equivalent function of SDL's windowSize(), framebufferSize() in wxwidgets

49 views
Skip to first unread message

AsmWarrior

unread,
Jul 21, 2021, 10:35:05 AM7/21/21
to wx-users
Hi, I try to port some magnum example code using SDL2 library to wxWidgets.

This one: https://github.com/mosra/magnum-examples/blob/master/src/arcball/ArcBallExample.cpp

and now, the ported project is located in https://github.com/asmwarrior/magnum-wx

I see some code in the SDL2 example was:

[code]
    /* Set up the camera */
    {
        /* Setup the arcball after the camera objects */
        const Vector3 eye = Vector3::zAxis(-10.0f);
        const Vector3 center{};
        const Vector3 up = Vector3::yAxis();
        _arcballCamera.emplace(_scene, eye, center, up, 45.0_degf,
            windowSize(), framebufferSize());
    }
[/code]

For me, I don't know what the equivalent functions under wxWidgets, so I just changed to

[code]
    /* Set up the camera */
    {
        /* Setup the arcball after the camera objects */
        int w = GetSize().GetWidth();
        int h = GetSize().GetHeight();

        const Vector3 eye = Vector3::zAxis(-10.0f);
        const Vector3 center{};
        const Vector3 up = Vector3::yAxis();
        _arcballCamera.emplace(_scene, eye, center, up, 45.0_degf,
            Vector2i{w,h}, Vector2i{w,h});
    }
[/code]

You see, I just set those two function call as the same width and height. Am I right? I really don't know if there is a wxWidgets function which could get the frame buffer size.

Thanks.

PS: I just want to post this message to the forums.wxWidgets.org, but that forum has some issue, I can't post there, so I posted it help for help, thanks.

Manolo

unread,
Jul 21, 2021, 1:14:48 PM7/21/21
to wx-users
Those " windowSize(), framebufferSize()" are not SDL2 functions (all SDL funcs begin with "SDL_"
Looking inside the link you posted, they seem more Magnum calls, or some custom vector initialization.

I know nothing of Magnum. I suspect " windowSize()" is for the client size of the window. " framebufferSize()" seems to me the size of the gl-buffer associated with the glView used (i.e., same size).

AsmWarrior

unread,
Jul 21, 2021, 9:52:37 PM7/21/21
to wx-users
Hi,  Manolo, thanks for the reply.

Let me ask on the magnum's forum for help.

Your guess is just the same as mine.
Reply all
Reply to author
Forward
0 new messages