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