for better accuracy, instead of GLfloat, I bound double data and tried to use the data in shader as follow: (I just tested to draw single triangle.)
cpp.
// xyzw three vertices
double points[] = { 0.0, 0.0, 0.0, 1.0 , 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0 };
glGenVertexArrays(1, VAO);
glBindVertexArray(VAO);
glGenBuffers(1, &VBO);
glBindBuffer(GL_ARRAY_BUFFER, VBO);
glBufferData(GL_ARRAY_BUFFER, 96, points, GL_STATIC_DRAW);
int data = 0;
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 4, GL_DOUBLE, GL_FALSE, 0, (void*)data);
shader.
#version 460 core
layout(location = 0) in dvec4 vPos;
void main() {
gl_Position = vec4(vPos);
}
What's worng with me?
(If I changed the dvec4 in the above shader to vec4, the triangle was drawn, but maybe it's not double anymore. I want to use double in shader.)