1

I was using OpengGL (Gles2WatchFaceService.engine) for my Wear-OS watch-face projects and it was working great for years. Recently however, this engine got deprecated and therefore, before I recode all my graphics, I am reevaluating if OpenGL is needed at all.

My question to any experienced (watch face) developers here is: When should I use OpenGL for the graphics of a watch face? Only for 3D animation? What about an analog watch face with hands that should move smoothly (with the animation frame rate switching between 5 and 40 fps)? (I am also using some color blending with alpha channel, not sure if I can do that without OpenGL.)

It comes basically down to these considerations:

  1. OpenGL for pure 2D animation could result in smoother animation at a lower CPU load. But, is this always true? Or can I get easily 40 fps for animating up to 9 graphical elements without OpenGL?

  2. Am I getting the advantages of OpenGL (if there are any) at a cost of a more complicated code and more compatibility problems in the future (due to SW and HW updates)?

If OpenGL is the way to go, perhaps someone can point me to a good and recent code example (preferably java), because I can't find any.

Any help/comments appreciated!

Rabbid76
  • 202,892
  • 27
  • 131
  • 174
go3d
  • 443
  • 3
  • 11
  • 1
    Great question. I know you are aware of this example, but listing it here also for completeness. https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:wear/watchface/watchface/samples/src/main/java/androidx/wear/watchface/samples/ExampleOpenGLWatchFaceService.kt – Yuri Schimke Mar 10 '22 at 07:11
  • Thanks Yuri! I am trying to get that example to run, but I'm having a hard time. Any idea of how to download all needed files at once? – go3d Mar 11 '22 at 02:32
  • Tried for hours to find a similar example in Java, but to no avail. Any ideas where I could find it? My project is quite extensive and all made in Java. It would take me a really long time to convert it to Kotlin. Any help appreciated. – go3d Mar 11 '22 at 04:32
  • 1
    There mostly a 1:1 mapping for kotlin to java code. Can you use it as a guide? What bits are hard to mentally convert from kotlin to java? – Yuri Schimke Mar 11 '22 at 06:39
  • With some effort I guess I could convert it to java. My bigger problem though is that the new watch face classes are completely different than the deprecated ones. The whole structure changed! I am having the hardest time solving even the simplest tasks like implementing a tap listener. Another problem is that Android Studio is still delivering the deprecated templates when creating a new watch face project. Is there a way to make AS deliver the new ones? – go3d Mar 11 '22 at 17:23
  • There are docs for handling tap events https://developer.android.com/training/wearables/watch-faces/interacting – Yuri Schimke Mar 11 '22 at 17:46
  • Thanks. I am having the hardest time to understand how to implement the taplistener. And, can I even get the x and y coordinates of the tap or just the fact that the user tapped? If I could only find a working example... – go3d Mar 12 '22 at 16:52
  • 1
    The TapEvent has the X & Y coordinates. – Yuri Schimke Mar 12 '22 at 17:09
  • Ok, thanks. I saw it now. But it is still very confusing. I will post a dedicated question for this. – go3d Mar 12 '22 at 22:19

0 Answers0