Python Opengl PyOpengl Drawing Triangle #3

preview_player
Показать описание
Check our website

This is our third video in Python Opengl Programming With PyOpengl
in this video we are going to start our modern opengl programming
and we are drawing a nice triangle in modern opengl where we have vertex shader
and fragment shader that runs on GPU(Graphic Process Unit)

What Is Shaders ?

haders are little programs that rest on the GPU. These programs are run for each specific section of the graphics pipeline. In a basic sense, shaders are nothing more than programs transforming inputs to outputs. Shaders are also very isolated programs in that they're not allowed to communicate with each other; the only communication they have is via their inputs and outputs.

In the previous tutorial we briefly touched the surface of shaders and how to properly use them. We will now explain shaders, and specifically the OpenGL Shading Language, in a more general fashion.

What Is GLSL ?
Shaders are written in the C-like language GLSL. GLSL is tailored for use with graphics and contains useful features specifically targeted at vector and matrix manipulation.

Shaders always begin with a version declaration, followed by a list of input and output variables, uniforms and its main function. Each shader's entry point is at its main function where we process any input variables and output the results in its output variables. Don't worry if you don't know what uniforms are, we'll get to those shortly.

Data Types In GLSL
Vectors
A vector in GLSL is a 1,2,3 or 4 component container for any of the basic types just mentioned. They can take the following form (n represents the number of components):

vecn: the default vector of n floats.
bvecn: a vector of n booleans.
ivecn: a vector of n integers.
uvecn: a vector of n unsigned integers.
dvecn: a vector of n double components.
Most of the time we will be using the basic vecn since floats are sufficient for most of our purposes.

Components of a vector can be accessed via vec.x where x is the first component of the vector. You can use .x, .y, .z and .w to access their first, second, third and fourth component respectively. GLSL also allows you to use rgba for colors or stpq for texture coordinates, accessing the same components.

The vector datatype allows for some interesting and flexible component selection called swizzling. Swizzling allows for the following syntax:

Learn Complete Opengl In The Link

Another Link For Learning Opengl

Another Link For Learning Opengl

Another Linke For Learning Modern Opengl

Link Of Videos For Modern Opengl

GLSL Programming Wiki Book
Рекомендации по теме
Комментарии
Автор

Hello! Are you going to continue Python Opengl videos. You did a nice job!

Jackson-yrih
join shbcf.ru