# \[Moving frames\] Graphics problem

**URL:** <https://iplug2.discourse.group/t/moving-frames-graphics-problem/467>\
**Category:** macOS\
**Created:** [31 August 2021 16:44 UTC](https://iplug2.discourse.group/t/moving-frames-graphics-problem/467 "2021-08-31T16:44:22Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![SKyZz](https://avatars.discourse-cdn.com/v4/letter/s/4491bb/32.png) [@SKyZz](https://iplug2.discourse.group/u/SKyZz)\
**Post date:** [31 August 2021 16:44 UTC](https://iplug2.discourse.group/t/moving-frames-graphics-problem/467/1 "2021-08-31T16:44:22Z")

</div>

Graphics: NANOVG / OpenGL2  
Platform: macOs 11.XX  
DAW: Logic Pro X

The problem is that it is on macOS that moving parts, handles, or arrows are rendered as black areas when opened.

![Screenshot 2021-08-31 at 19.39.43](https://global.discourse-cdn.com/free1/uploads/iplug2/original/1X/2f36412767e4dbfed35496610e27e3ba53c42531.png)

There are no errors when opening it. And the code looks sane:

```auto
bitmap = pGraphics->LoadBitmap(KNOB_FN, kKnob_N);         
pGraphics->AttachControl(new IKnobMultiControlText(pGraphics, IRECT(kIn1_X, kIn1_Y, kIn1_X kIn1_Y), kIn1, &bitmap, 17, 0));

```

We tried a lot of variety for testing but didn’t get any results. If you have any ideas, please go ahead saying. Thanks

---

<div class="post-metadata">

**Author:** ![olilarkin](https://yyz2.discourse-cdn.com/free1/user_avatar/iplug2.discourse.group/olilarkin/32/2_2.png) [@olilarkin](https://iplug2.discourse.group/u/olilarkin)\
**Post date:** [31 August 2021 17:19 UTC](https://iplug2.discourse.group/t/moving-frames-graphics-problem/467/2 "2021-08-31T17:19:33Z")

</div>

I don’t recommend using OpenGL on MacOS. also make sure textures aren’t too large (\> 16384px)

---

<div class="post-metadata">

**Author:** ![SKyZz](https://avatars.discourse-cdn.com/v4/letter/s/4491bb/32.png) [@SKyZz](https://iplug2.discourse.group/u/SKyZz)\
**Post date:** [31 August 2021 17:31 UTC](https://iplug2.discourse.group/t/moving-frames-graphics-problem/467/3 "2021-08-31T17:31:20Z")

</div>

1. Of course, this is a bad experience, but METAL graphics closes without warning/errors.
2. large (\> 16384px) - yes but here’s the strange thing, this in Reaper plugins of the VST & VST3 format open without problems.

Original size of knob = 74x9472 pix - logically, to solve the problem with the Retin@ display, we increase this image twice (158 x 18944 - image@2x.img). Maybe there is some workaround for AU, for Retin@?

---

<div class="post-metadata">

**Author:** ![olilarkin](https://yyz2.discourse-cdn.com/free1/user_avatar/iplug2.discourse.group/olilarkin/32/2_2.png) [@olilarkin](https://iplug2.discourse.group/u/olilarkin)\
**Post date:** [31 August 2021 17:34 UTC](https://iplug2.discourse.group/t/moving-frames-graphics-problem/467/4 "2021-08-31T17:34:02Z")

</div>

I’ve thought about adding some behind the scenes logic to Split the image up into multiple textures but didn’t have time yet. Skia does not have this problem

---

<div class="post-metadata">

**Author:** ![SKyZz](https://avatars.discourse-cdn.com/v4/letter/s/4491bb/32.png) [@SKyZz](https://iplug2.discourse.group/u/SKyZz)\
**Post date:** [31 August 2021 17:55 UTC](https://iplug2.discourse.group/t/moving-frames-graphics-problem/467/5 "2021-08-31T17:55:47Z")

</div>

I failed to build SKIA under M1 is there a bypass to this process?

```auto
# URLs where tarballs of releases can be downloaded - no trailing slash
PNG_URL=https://github.com/glennrp/libpng/archive
ZLIB_URL=https://www.zlib.net
FREETYPE_URL=https://download-mirror.savannah.gnu.org/releases/freetype/
SKIA_URL=https://github.com/google/skia.git

```

Could you update please: FREETYPE\_URL from **download-igraphics-libs.sh**

I don’t know how to solve this problem yet (use **build-igraphics-libs-mac.sh** ):

```auto
/Dependencies/Build/src/freetype/src/tools/apinames.c:19:10: fatal error: 'stdio.h' file not found
#include <stdio.h>

```

---

<div class="post-metadata">

**Author:** ![olilarkin](https://yyz2.discourse-cdn.com/free1/user_avatar/iplug2.discourse.group/olilarkin/32/2_2.png) [@olilarkin](https://iplug2.discourse.group/u/olilarkin)\
**Post date:** [31 August 2021 17:58 UTC](https://iplug2.discourse.group/t/moving-frames-graphics-problem/467/6 "2021-08-31T17:58:02Z")

</div>

why not just use prebuilt SKIA with the [download-prebuilt-libs.sh](https://github.com/iPlug2/iPlug2/blob/master/Dependencies/download-prebuilt-libs.sh) script?

or download the zip

> **[iPlug2/Dependencies at master · iPlug2/iPlug2](https://github.com/iPlug2/iPlug2/tree/master/Dependencies)**
>
> master/Dependencies

will check the freetype url when I have time

---

<div class="post-metadata">

**Author:** ![SKyZz](https://avatars.discourse-cdn.com/v4/letter/s/4491bb/32.png) [@SKyZz](https://iplug2.discourse.group/u/SKyZz)\
**Post date:** [31 August 2021 18:57 UTC](https://iplug2.discourse.group/t/moving-frames-graphics-problem/467/7 "2021-08-31T18:57:10Z")

</div>

```auto
||mkdir $HOME/deps|
| --- | --- |
||cd $HOME/deps|
||git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git|
||git clone https://github.com/google/skia.git|
||export PATH="${PWD}/depot_tools:${PATH}"|

```

it seems that the build script is a little outdated, I tried to debug it but so far without success ( **build-skia-mac.sh** )

```auto
export DEPOT_TOOLS_PATH=../Build/tmp/depot_tools

if [! -d $DEPOT_TOOLS_PATH]; then
   git clone 'https://chromium.googlesource.com/chromium/tools/depot_tools.git' $DEPOT_TOOLS_PATH
   git clone 'https://github.com/google/skia.git' ../Build/tmp
   cp -R ../Build/tmp/skia/tools ../Build/src/skia
fi

export PATH="${PWD}/$DEPOT_TOOLS_PATH:${PATH}"

cd ../Build/src/skia
python tools/git-sync-deps # problem with DEPS
./bin/gn gen ../../tmp/skia/macOS_x86_64 --args='

```

_/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can’t open file ‘tools/git-sync-deps’: [Errno 2] No such file or directory_  
_/Dependencies/IGraphics/build-skia-mac.sh: line 15: ./bin/gn: No such file or directory_

---

<div class="post-metadata">

**Author:** ![olilarkin](https://yyz2.discourse-cdn.com/free1/user_avatar/iplug2.discourse.group/olilarkin/32/2_2.png) [@olilarkin](https://iplug2.discourse.group/u/olilarkin)\
**Post date:** [31 August 2021 21:43 UTC](https://iplug2.discourse.group/t/moving-frames-graphics-problem/467/8 "2021-08-31T21:43:58Z")

</div>

skia build works fine here on macOS big sur.

---

<div class="post-metadata">

**Author:** ![SKyZz](https://avatars.discourse-cdn.com/v4/letter/s/4491bb/32.png) [@SKyZz](https://iplug2.discourse.group/u/SKyZz)\
**Post date:** [1 September 2021 15:34 UTC](https://iplug2.discourse.group/t/moving-frames-graphics-problem/467/9 "2021-09-01T15:34:37Z")

</div>

When downloading the archive from here ([iPlug2/Dependencies at master · iPlug2/iPlug2 · GitHub](https://github.com/iPlug2/iPlug2/tree/master/Dependencies)), it lacks the necessary tools to **continue compiling** , and there are no instructions on this matter…

In the console, an explicit indication in the absence of the necessary folders and files

Steps:

1. Pre-built macOS dependencies can be downloaded here: [IPLUG2\_DEPS\_MAC.zip](https://github.com/iPlug2/iPlug2/releases/download/setup/IPLUG2_DEPS_MAC.zip)

Copy to iPlug2/Dependencies/Build/

```auto
iPlug2/Dependencies/Build/src/
iPlug2/Dependencies/Build/mac/
iPlug2/Dependencies/Build/mac/bin
iPlug2/Dependencies/Build/mac/include
iPlug2/Dependencies/Build/mac/lib
iPlug2/Dependencies/Build/mac/share

```

1. The build script **build-igraphics-libs-mac.sh** will build freetype as a static library (only required if you are using IGRAPHICS\_FREETYPE with IGRAPHICS\_NANOVG) and will install it in a unix style hierarchy in the folder \*\*iPlug2/Dependencies/Build/mac . Build settings defined in **iPlug2/common-mac.xcconfig** will allow your plug-in project to link to these libraries. The libraries are built as universal binaries with x86\_64 and arm64 architectures.

Next you can execute **build-skia-mac.sh** which will build the various static libraries for skia and place the files in the right locations.

Just _ **Run build-skia-mac.sh** _

```auto
cd /IGraphics
./build-skia-mac.sh 
Cloning into '../Build/tmp/depot_tools'...
remote: Total 45900 (delta 34382), reused 45900 (delta 34382)
Receiving objects: 100% (45900/45900), 32.63 MiB | 23.01 MiB/s, done.
Resolving deltas: 100% (34382/34382), done.
/opt/homebrew/bin/python3: can't open file '///Dependencies/Build/src/skia/tools/git-sync-deps': [Errno 2] No such file or directory
///Dependencies/IGraphics/build-skia-mac.sh: line 15: ./bin/gn: No such file or directory
ninja: Entering directory `../../tmp/skia/macOS_x86_64'
ninja: fatal: chdir to '../../tmp/skia/macOS_x86_64' - No such file or directory
ERROR: build failed, aborting

```

Either I’m doing something wrong or something is missing…

---

<div class="post-metadata">

**Author:** ![olilarkin](https://yyz2.discourse-cdn.com/free1/user_avatar/iplug2.discourse.group/olilarkin/32/2_2.png) [@olilarkin](https://iplug2.discourse.group/u/olilarkin)\
**Post date:** [1 September 2021 16:12 UTC](https://iplug2.discourse.group/t/moving-frames-graphics-problem/467/10 "2021-09-01T16:12:35Z")

</div>

They are pre built libraries

Just run the script in dependencies to download them to the right place

---

<div class="post-metadata">

**Author:** ![SKyZz](https://avatars.discourse-cdn.com/v4/letter/s/4491bb/32.png) [@SKyZz](https://iplug2.discourse.group/u/SKyZz)\
**Post date:** [1 September 2021 16:29 UTC](https://iplug2.discourse.group/t/moving-frames-graphics-problem/467/11 "2021-09-01T16:29:36Z")

</div>

```auto
1. download-prebuilt-libs.sh (original)
2. download-igraphics-libs.sh (+fixed link)
3. build-skia-mac.sh (+ fixed )

python=`which python3` # any path

cd ../Build/src/skia
$python tools/git-sync-deps
./bin/gn gen ../../tmp/skia/macOS_x86_64 --args='

```

/Dependencies/Build/src/skia/tools/git-sync-deps

 ![Screenshot 2021-09-01 at 19.28.51](https://global.discourse-cdn.com/free1/uploads/iplug2/original/1X/93ff184ed77e261ef1c609391bf1b2f58551bbc9.png)

I have no idea what else I have to run for this folder to appear

---

<div class="post-metadata">

**Author:** ![olilarkin](https://yyz2.discourse-cdn.com/free1/user_avatar/iplug2.discourse.group/olilarkin/32/2_2.png) [@olilarkin](https://iplug2.discourse.group/u/olilarkin)\
**Post date:** [1 September 2021 16:32 UTC](https://iplug2.discourse.group/t/moving-frames-graphics-problem/467/12 "2021-09-01T16:32:44Z")

</div>

If you download prebuilt, you don’t need to build it!

Instructions [iPlug2/Dependencies at master · iPlug2/iPlug2 · GitHub](https://github.com/iPlug2/iPlug2/tree/master/Dependencies)

---

<div class="post-metadata">

**Author:** ![SKyZz](https://avatars.discourse-cdn.com/v4/letter/s/4491bb/32.png) [@SKyZz](https://iplug2.discourse.group/u/SKyZz)\
**Post date:** [1 September 2021 16:41 UTC](https://iplug2.discourse.group/t/moving-frames-graphics-problem/467/13 "2021-09-01T16:41:54Z")

</div>

If everything was so simple and magical I wouldn’t worry too much:

prebuilt libs

 ![Screenshot 2021-09-01 at 19.40.45](https://global.discourse-cdn.com/free1/uploads/iplug2/original/1X/fa8c88e6e478c93d3857770c01ef6958e1d10e27.png)

---

<div class="post-metadata">

**Author:** ![olilarkin](https://yyz2.discourse-cdn.com/free1/user_avatar/iplug2.discourse.group/olilarkin/32/2_2.png) [@olilarkin](https://iplug2.discourse.group/u/olilarkin)\
**Post date:** [1 September 2021 16:49 UTC](https://iplug2.discourse.group/t/moving-frames-graphics-problem/467/14 "2021-09-01T16:49:10Z")

</div>

It shouldn’t be so complicated. Not at computer now but will try it soon

---

<div class="post-metadata">

**Author:** ![SKyZz](https://avatars.discourse-cdn.com/v4/letter/s/4491bb/32.png) [@SKyZz](https://iplug2.discourse.group/u/SKyZz)\
**Post date:** [1 September 2021 17:44 UTC](https://iplug2.discourse.group/t/moving-frames-graphics-problem/467/15 "2021-09-01T17:44:33Z")

</div>

The problem has been resolved…

> **[03\_Switching\_graphics · iPlug2/iPlug2 Wiki](https://github.com/iPlug2/iPlug2/wiki/03_Switching_graphics)**
>
> C++ Audio Plug-in Framework for desktop, mobile and web \[PRE-RELEASE\] - 03\_Switching\_graphics · iPlug2/iPlug2 Wiki

from

-EXTRA\_LNK\_FLAGS = //$(IGRAPHICS\_LNK\_FLAGS)  
+**EXTRA\_LNK\_FLAGS = $(IGRAPHICS\_LNK\_FLAGS)**

to

EXTRA\_LNK\_FLAGS = **-framework Metal -framework MetalKit -framework OpenGL $(IGRAPHICS\_LNK\_FLAGS)**

1. Dependencies → download-prebuilt-libs.sh
2. Set:

EXTRA\_LNK\_FLAGS = -framework Metal -framework MetalKit -framework OpenGL $(IGRAPHICS\_LNK\_FLAGS)

EXTRA\_ALL\_DEFS = OBJC\_PREFIX=vPlug SWELL\_APP\_PREFIX=Swell\_vPlug GRAPHICS\_SKIA IGRAPHICS\_METAL / CPU / GL2 / GL3
