Book Image

Kivy Cookbook

By : Hugo Solis
Book Image

Kivy Cookbook

By: Hugo Solis

Overview of this book

Table of Contents (16 chapters)
Kivy Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Editing shaders


Kivy, of course, permits us to work with shaders. The shaders calculate rendering effects with the help of the GPU. In this recipe, we will use a predefined shader that we will load from a glsl file, which is the common extension of the OpenGL Shading Language (GLSL).

Getting ready

We are going to need a glsl file to work with in this recipe; there exist thousands free on the Web.

Note

A nice place to look is the site http://www.iquilezles.org/apps/shadertoy/index2.html where you could find your favorite.

Also, you should be familiar with some concepts about shaders, so you can start reading the Wikipedia article at http://en.wikipedia.org/wiki/OpenGL_Shading_Language.

How to do it…

In this recipe, we will use the KV, Python, and glsl files of our choice. In the KV file, we will provide the size and position of the shader in the app, and in the Python file, we will set the behavior of the shader. Let's follow the next steps:

  1. Open the glsl file and add the next header after the #endif...