C++/OpenGLES coding, sync problems?

Post Reply
BrianBeuken
Posts: 31
Joined: Sun Feb 14, 2016 2:16 am
languages_spoken: english
ODROIDs: C1+
C2
XU4
C4
N2
Has thanked: 2 times
Been thanked: 0
Contact:

C++/OpenGLES coding, sync problems?

Post by BrianBeuken »

I love that my XU4 is a fast beast but it does someimes mean it runs way too fast on projects. Normally I sync to the EGL swap rate which synces to the display, so 60fps more of the time, using this command

EGLBoolean test = eglSwapInterval(display, 1); // 1 to lock speed to 60fps (assuming we are able to maintain it), 0 for immediate swap (may cause tearing) which will indicate actual frame rate
// on xu4 this seems to have no effect

But as the comment notes, this has no effect on an XU4, though it does return as true indicating it didn't fail, does anyone know why, and what would be a good work around?

User avatar
odroid
Site Admin
Posts: 35266
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean, Japanese
ODROIDs: ODROID
Has thanked: 1074 times
Been thanked: 822 times
Contact:

Re: C++/OpenGLES coding, sync problems?

Post by odroid »

Which OS image do you use?
Are running the EGL on the x11? or DRM-FB or Wayland?

BrianBeuken
Posts: 31
Joined: Sun Feb 14, 2016 2:16 am
languages_spoken: english
ODROIDs: C1+
C2
XU4
C4
N2
Has thanked: 2 times
Been thanked: 0
Contact:

Re: C++/OpenGLES coding, sync problems?

Post by BrianBeuken »

I'm using Ubuntu 16.05.6 lts
with EGL on X11


(btw, I would really love to see a simple tutorial on how to render to DRM-FB and Wayland?)

crashoverride
Posts: 5101
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 365 times
Contact:

Re: C++/OpenGLES coding, sync problems?

Post by crashoverride »

For X11, add the following code to synchronize with the vertical refresh:
https://github.com/OtherCrashOverride/m ... pp#L55-L71
These users thanked the author crashoverride for the post:
BrianBeuken (Sun Dec 15, 2019 7:41 am)

BrianBeuken
Posts: 31
Joined: Sun Feb 14, 2016 2:16 am
languages_spoken: english
ODROIDs: C1+
C2
XU4
C4
N2
Has thanked: 2 times
Been thanked: 0
Contact:

Re: C++/OpenGLES coding, sync problems?

Post by BrianBeuken »

thanks I will try that, will it impact on other SBC's which do allow the EGL swapinterval to sync?

crashoverride
Posts: 5101
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 365 times
Contact:

Re: C++/OpenGLES coding, sync problems?

Post by crashoverride »

I have only tested it on XU4 and PC where "eglSwapInterval(display, 0);" is used. The behavior on other SBCs will depend on too many things to make a prediction.
These users thanked the author crashoverride for the post:
BrianBeuken (Sun Dec 15, 2019 12:37 pm)

Post Reply

Return to “General Topics”

Who is online

Users browsing this forum: No registered users and 0 guests