added more code to render my first scene; STILL WITH ERRORS
This commit is contained in:
22
opengl_beginnings/resources/shaders/sphere.vert
Normal file
22
opengl_beginnings/resources/shaders/sphere.vert
Normal file
@ -0,0 +1,22 @@
|
||||
#version 330 core
|
||||
|
||||
layout(location=0) in vec3 position;
|
||||
layout(location=1) in vec3 normals;
|
||||
|
||||
uniform mat4 modelMatrix;
|
||||
uniform mat4 viewMatrix;
|
||||
uniform mat4 projectionMatrix;
|
||||
|
||||
//out vec3 fragPos;
|
||||
//out vec3 fragNormal;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 pos = vec4(position, 1.0);
|
||||
|
||||
// the inverse should be calculated on the CPU as it is quite expensive to run and doesn't need to be run for every vertex
|
||||
// fragNormal = mat3(transpose(inverse(modelMatrix))) * normals;
|
||||
// fragPos = vec3(modelMatrix * pos);
|
||||
|
||||
gl_Position = projectionMatrix * viewMatrix * modelMatrix * pos;
|
||||
}
|
Reference in New Issue
Block a user