Hi,
somehow my first “OpenGL 3.2 core profile” triangle always
stays white even if I directly change the color to red
in the minimal fragment shader:
#version 150 core
out vec4 out_Color;
void main(void)
{
out_Color = vec4(1.0, 0.0, 0.0, 1.0);
}
#version 150 core
in vec3 in_Position;
void main(void)
{
gl_Position= vec4(in_Position, 1.0);
}
Here is my code:
float* vert = new float[9];
vert[0] = 0.0; vert[1] = 0.5; vert[2] =-1.0;
vert[3] =-1.0; vert[4] =-0.5; vert[5] =-1.0;
vert[6] = 1.0; vert[7] =-0.5; vert[8]= -1.0;
unsigned int m_vaoID;
unsigned int m_vboID;
glGenVertexArrays(1, &m_vaoID);
glBindVertexArray(m_vaoID);
glGenBuffers(1, &m_vboID);
glBindBuffer(GL_ARRAY_BUFFER, m_vboID);
glBufferData(GL_ARRAY_BUFFER, 9 * sizeof(GLfloat), vert, GL_STATIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
glEnableVertexAttribArray(0);
glDrawArrays(GL_TRIANGLES, 0, 3);
glBindVertexArray(0);
delete[] vert;
delete[] col;
glBindBuffer(GL_ARRAY_BUFFER, 0);
glDeleteBuffers(1, &m_vboID);
glDeleteVertexArrays(1, &m_vaoID);
Help is really appreciated!