beta
cables is under heavy development.
There might be one or another bug, please let us know about it!
cables DocumentationHow To UseWorking with filesKeyboard ShortcutsUser Interface WalkthroughBeginner TutorialBeginner 1: Drawing A CircleBeginner 2: TransformationsBeginner 3: ColorMore TransformationsintermediateImage CompositionsPost-Processing 3D Scenescommunicationcables APICommunication with an Arduino via SerialCommunicating with Arduino over MQTTExporting And EmbeddingHow to serve files externally and fix CORS headersExporting PatchesExport using the cables command line interfaceExport via IframeExport creating a standalone executableExport to github (pages)Export and deploy to netlifyExport a ZIP fileExternal triggers / functionsUsing variablesPreviewing / uploading exported cables patchescoding opsCreating AttachmentsGeneral op/Port CallbacksPortsDynamic PortsArray PortsBoolean portsInteger Number PortsObject PortsString portsTrigger PortsFloating Point Number PortsGUI/UI attributesHello Op - Part 1LibrariesDeveloping OpsGuidelinesObject PortsWriting ShadersWeb Audio Op DevelopmentHTML and CSS in cablesLightingLightsShadowsWorking with audioBasic Audio SetupWorking with EffectsReal-Time Audio Analyzation & Audio VisualizationOffline Audio Visualization & AnalyzationFAQEmbeddingHow to integrate my cables patch into my CMS (webflow/wix/squarespace/...)?getting a warning when running the patch in electronHow to remove grey rectangles on touch (mobile)?Why doesn't the DownloadTexture op work on iOS?How to disable page scrolling on mobile?Mobile tippsTransparent CanvasFeatures and SupportHow to contribute code to cablesWill there be support for (animated) GIFs?How to report a bug in cablesGeneral questionsLicences and paymentWhat licence do i need to use cables?Will I have to pay for it in the future?How is my work licenced when using cables?Does cables support midi and OSC?ShadertoyTechnical questionsUI / EditorGuide to VR in cablesWebGL1 and WebGL2

WebGL1 and WebGL2

A little overview

The underlying interface that allows 3D graphics on the web to be rendered natively is called WebGL. WebGL was first released in 2011 with WebGL1. WebGL2, the next iteration of WebGL, was made availible in 2017. WebGL2 features new features. If you are interested in the details of the specification & differences, have a look here.

Why would this matter to you, the user?

WebGL2 has been adopted by most of modern browsers (Chrome, Firefox, Opera, Edge).

There are two platforms that still use WebGL1: macOS (Safari) and iOS (every browser). If you plan on making your patch functional for these platforms, there are a few things to keep in mind:

MipMapping & Power of Two Textures

WebGL1 only supports mipmapping for power of two textures. What does that mean?

First off, what is mipmapping?

Put simply, mipmapping saves your texture in different resolutions internally so the graphics card can choose which resolution is optimal to display your texture without artifacts. See the following picture for a visual explanation:

mipmapping

As you can see, there are moiré artefacts in the background without mipmapping. These disappear when mipmapping is enabled.
When using the Texture op, mipmapping is enabled automatically.

Mipmapping in WebGL1

WebGL1 allows mipmapping only for textures that have dimensions that are a power of two.

What does that mean?

Here are the powers of two: 0, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, ...

Mipmap filtering will only work if the dimensions, the width and the height, of the texture are one of these numbers. Width and height do not need to be the same size, but both values need to be a power of two.

Texture dimension examples that work: 1024 by 1024, 256 by 2048, 512 by 128 and so on.

Texture dimension examples that do not work: 1038 by 2030, 540 by 1300, ...

Scaling a texture to the next power of two

Fortunately, cables allows you to resize a texture to the closest power of two within the application:

If you open the file browser and click on the texture you desire to resize, the following options will appear:

resize_start

If you look at the bottom of the screenshot, you can see marked in yellow the current size of your image. At the bottom right of your dimensions, there are a few buttons that allow you to process your image through cables. The relevant button to resize to the next power of two is marked in bright green.

After clicking it, a dialogue appears and asks you if you want to resize the texture. If you do that, the following dialogue will appear:

resize_start

Your texture is now resized to the next power of two and usable for mipmapping in WebGL1.

Mipmapping in WebGL2

Mipmapping in WebGL2 works for every resolution.


help cables get better and edit this file on github