fix: assign vertex shader, unbind vao

This commit is contained in:
parker
2025-06-26 00:53:22 +01:00
parent 0acc1a0bd9
commit f060676330

View File

@@ -43,9 +43,8 @@ protected:
"{\n"
" gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);\n"
"}\n";
GLuint vertexShader;
// shader type
glCreateShader(GL_VERTEX_SHADER);
GLuint vertexShader = glCreateShader(GL_VERTEX_SHADER);
// convert source
const GLchar* vertexShaderSourceC = vertexShaderSource.c_str();
// create shader object
@@ -81,6 +80,9 @@ protected:
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3*sizeof(GLfloat), (void*)0);
glEnableVertexAttribArray(0);
// unbind vertex array
glBindVertexArray(0);
QSurfaceFormat fmt = context()->format();
std::cout << "format: " << (fmt.renderableType() == QSurfaceFormat::OpenGLES ? "GLES" : "Desktop") << "\n";
std::cout << "format: " << (fmt.renderableType() == QSurfaceFormat::OpenGL ? "true" : "false") << "\n";