Hi,
I’m writing this code but I can’t figure out why the cube is still in white:
GLuint VAO;
glGenVertexArrays(1, &VAO);
glBindVertexArray(VAO);
/* ALLOCATE THE BUFFER FOR OPENGL USE */
unsigned int buffer;
GLuint normal;
GLuint col;
/* GENERATE THE BUFFER (1 BUUFER) */
glGenBuffers(1, &buffer);
/* SELECT THAT BUFFER TO WORK WITH */
glBindBuffer(GL_ARRAY_BUFFER, buffer);
glBufferData(GL_ARRAY_BUFFER, RealPositions.size()*sizeof(float), RealPos, GL_STATIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
glEnableVertexAttribArray(0);
glGenBuffers(1, &col);
glBindBuffer(GL_ARRAY_BUFFER, col);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertex_color), vertex_color, GL_STATIC_DRAW);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, 0);
glEnableVertexAttribArray(1);
this is my fragment shader:
#version 330 core
in vec3 vs_color;
out vec4 gl_FragColor;
void main()
{
gl_FragColor = vec4(1.0, 0.7, 0.0, 1.0);
}
and this is my vertex shader:
#version 330 core
layout (location = 0) in vec3 RealPos;
layout (location = 1) in vec3 vertex_color;
out vec3 vs_pos;
out vec3 vs_color;
void main()
{
vs_pos = RealPos;
vs_color = vertex_color
gl_Position = vec4(vs_pos, 1.0);
}
I use the Intel HD Graphics 5500 and I installed the last driver from HP website.
can someone help me? why I only get a white Cube?