Shaders development for Minecraft - GLSL Basic

The OpenGL Shading Language is a C-style language, so it covers most of the features you would expect with such a language. Control structures (for-loops, if-else statements, etc) exist in GLSL, including the switch statement.

GLSL provides a lot of predefined functions to help creator create shader more easily. It includes the most math function that will probably be used in development. You can check those functions in GLSL API Document. OpenGL Official also provides a guide to introduce glsl. Seen here,GLSL Specs.
For GLSL, Besides the macro names reserved by Core Language, all macro names containing two consecutive underscores ( __ ) are reserved for future use as predefined macro names. All macro names prefixed with “GL_” (not case-sensitive) are also reserved.
The main part of GLSL contains two different types of file which are Vertex Shader and Fragment Shader.
As it known to all, Computer draws 3D objects triangle by triangle.Inside the Vertex Shader, The code takes in the vertex data of each triangle and process it. Then, result is passed to the Fragment Shader. Fragment Shader can output the data to Draw Buffer so that the final image can be shown on the screen.

posted @ 2022-01-03 22:25  L1bra  阅读(45)  评论(0编辑  收藏  举报