iPlug2 Forum

[Moving frames] Graphics problem

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

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

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

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

  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@?

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

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

# 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):

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

why not just use prebuilt SKIA with the download-prebuilt-libs.sh script?

or download the zip

will check the freetype url when I have time

||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)

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

skia build works fine here on macOS big sur.

When downloading the archive from here (iPlug2/Dependencies at master · iPlug2/iPlug2 · GitHub), 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

Copy to iPlug2/Dependencies/Build/

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

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…

They are pre built libraries

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

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

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

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

Instructions iPlug2/Dependencies at master · iPlug2/iPlug2 · GitHub

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

prebuilt libs

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

The problem has been resolved…

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

1 Like