opengl

Sample code from LearnOpenGL.com
Log | Files | Refs

commit c4f54ac8aff3b3c3590f61052940dbf529aca328
parent db1e273b0daac9440c21c78d35c684c703cab174
Author: Matsuda Kenji <info@mtkn.jp>
Date:   Wed, 28 Jun 2023 06:30:17 +0900

add another surface

Diffstat:
Mmain.c | 16++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/main.c b/main.c @@ -53,20 +53,24 @@ main(void) float delta = 0.01; float vertices[] = { // positions, texture coords - 0.5, 0.5, 0.0, 1.0, 1.0, - -0.5, 0.5, 0.0, 0.0, 1.0, - -0.5, -0.5, 0.0, 0.0, 0.0, - 0.5, -0.5, 0.0, 1.0, 0.0, + 0.5, 0.5, 0.5, 1.0, 1.0, + -0.5, 0.5, 0.5, 0.0, 1.0, + -0.5, -0.5, 0.5, 0.0, 0.0, + 0.5, -0.5, 0.5, 1.0, 0.0, + 0.5, 0.5, -0.5, 0.0, 1.0, + 0.5, -0.5, -0.5, 0.0, 0.0, }; unsigned int indices[] = { 0, 1, 2, 0, 2, 3, + 0, 3, 5, + 0, 4, 5, }; mat *trans = matMake((float[]){1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0,}, 4); - vec *axis = vecMake((float[]){1.0, 0.0, 0.0}, 3); + vec *axis = vecMake((float[]){1.0, 1.0, 0.0}, 3); // initialize glfw glfwInit(); @@ -162,7 +166,7 @@ main(void) glUniform1i(glGetUniformLocation(shader->ID, "texture1"), 1); unsigned int tloc = glGetUniformLocation(shader->ID, "transform"); glUniformMatrix4fv(tloc, 1, GL_FALSE, matDataPtr(trans)); - glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0); + glDrawElements(GL_TRIANGLES, 12, GL_UNSIGNED_INT, 0); glfwPollEvents(); glfwSwapBuffers(window);