filmov
tv
OpenGL (C#) 2D Game Tutorial #2 - VAOs, VBOs & Shaders

Показать описание
This is the second episode in my OpenGL 2D Game tutorial series. In this video we'll be talking about the basics of how to render something - what VAOs, VBOs and shaders are.
Vertex data:
float[] vertices =
{
-0.5f, 0.5f, 1f, 0f, 0f, // top left
0.5f, 0.5f, 0f, 1f, 0f,// top right
-0.5f, -0.5f, 0f, 0f, 1f, // bottom left
0.5f, 0.5f, 0f, 1f, 0f,// top right
0.5f, -0.5f, 0f, 1f, 1f, // bottom right
-0.5f, -0.5f, 0f, 0f, 1f, // bottom left
};
Shaders:
string vertexShader = @"#version 330 core
layout (location = 0) in vec2 aPosition;
layout (location = 1) in vec3 aColor;
out vec4 vertexColor;
void main()
{
}";
string fragmentShader = @"#version 330 core
out vec4 FragColor;
in vec4 vertexColor;
void main()
{
FragColor = vertexColor;
}";
0:00 Introduction
0:15 What are VAOs & VBOs?
2:15 Initializing VAO & VBO
8:40 What are Shaders?
10:57 Initializing Shaders
12:20 Summary and what's next?
#gamedev #OpenGL #tutorial
Vertex data:
float[] vertices =
{
-0.5f, 0.5f, 1f, 0f, 0f, // top left
0.5f, 0.5f, 0f, 1f, 0f,// top right
-0.5f, -0.5f, 0f, 0f, 1f, // bottom left
0.5f, 0.5f, 0f, 1f, 0f,// top right
0.5f, -0.5f, 0f, 1f, 1f, // bottom right
-0.5f, -0.5f, 0f, 0f, 1f, // bottom left
};
Shaders:
string vertexShader = @"#version 330 core
layout (location = 0) in vec2 aPosition;
layout (location = 1) in vec3 aColor;
out vec4 vertexColor;
void main()
{
}";
string fragmentShader = @"#version 330 core
out vec4 FragColor;
in vec4 vertexColor;
void main()
{
FragColor = vertexColor;
}";
0:00 Introduction
0:15 What are VAOs & VBOs?
2:15 Initializing VAO & VBO
8:40 What are Shaders?
10:57 Initializing Shaders
12:20 Summary and what's next?
#gamedev #OpenGL #tutorial
Комментарии