more control fixes

This commit is contained in:
onezplpl 2024-07-19 14:05:26 -04:00
parent 1939e2dff5
commit 2ce46f188b
No known key found for this signature in database
GPG key ID: 7EC026A136F9EEC3
4 changed files with 23 additions and 14 deletions

19
main.c
View file

@ -354,9 +354,18 @@ int main(void) {
glUniform1i(use_shading, 0);
int iz = CBLOCK_ALL * 18;
int iz2 = iz;
cubes_rect(cubeO, &iz, -0.5, 0.5, -0.5, 0.5, 0, 0, 6);
cubes_rect(textO, &iz, -0.5, 0.5, -0.5, 0.5, 1, 0, 6);
for (int i = 0; i < 10; i++) {
iz += 6;
cubes_rect(cubeO, &iz, ((i - 4.5) * 2.5) - 1, ((i - 4.5) * 2.5) + 1, -11,
-9, 0, 1, 6);
cubes_rect(textO, &iz, ((i - 4.5) * 2.5) - 1, ((i - 4.5) * 2.5) + 1, -11,
-9, 1, 1, 6);
}
mat4x4_identity(v);
mat4x4_ortho(p, -ratio * 15, ratio * 15, -1.f * 15, 1.f * 15, 1.0f, -1.0f);
mat4x4_mul(mvp, p, v);
@ -365,15 +374,15 @@ int main(void) {
glUniformMatrix4fv(mvp_location, 1, GL_FALSE, (const GLfloat *)&mvp);
glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer[1]);
glBufferSubData(GL_ARRAY_BUFFER, CTRI_ALL, (long)6 * sizeof(struct v3f),
&textO[iz]);
glBufferSubData(GL_ARRAY_BUFFER, CTRI_ALL,
(long)6 * 11 * sizeof(struct v3f), &textO[iz2]);
glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer[0]);
glBufferSubData(GL_ARRAY_BUFFER, CTRI_ALL, (long)6 * sizeof(struct v3f),
&cubeO[iz]);
glBufferSubData(GL_ARRAY_BUFFER, CTRI_ALL,
(long)6 * 11 * sizeof(struct v3f), &cubeO[iz2]);
glBindVertexArray(vertex_array);
glDrawArrays(GL_TRIANGLES, CBLOCK_ALL * 18, 6);
glDrawArrays(GL_TRIANGLES, CBLOCK_ALL * 18, 6 * 11);
}
if (fp) {