some cursed struct shit

This commit is contained in:
Luca Conte 2024-03-21 14:03:18 +01:00
parent dccf1139df
commit 17ae922675
1 changed files with 21 additions and 17 deletions

View File

@ -19,6 +19,22 @@ GLfloat speedY = -0.0005f;
#define NUM_TRIANGLES 8 #define NUM_TRIANGLES 8
typedef struct {
GLfloat x;
GLfloat y;
} Point;
typedef struct {
Point p1;
Point p2;
Point p3;
} Triangle;
typedef struct {
Triangle t1;
Triangle t2;
} TriangleRect;
void createRect(GLfloat* vertexArray, GLfloat posx, GLfloat posy, GLfloat width, GLfloat height) { void createRect(GLfloat* vertexArray, GLfloat posx, GLfloat posy, GLfloat width, GLfloat height) {
vertexArray[0] = posx; vertexArray[0] = posx;
vertexArray[1] = posy; vertexArray[1] = posy;
@ -116,24 +132,12 @@ void init(void) {
} }
TriangleRect triangleVertices[4];
// create triangle buffer createCenterRect((GLfloat*)&triangleVertices[0], -0.2f, 0.0f, 0.1f, 1.2f);
// GLfloat triangleVertices[] = createCenterRect((GLfloat*)&triangleVertices[1], 0.2f, 0.0f, 0.1f, 1.2f);
// {// X Y createCenterRect((GLfloat*)&triangleVertices[2], 0.0f, 0.0f, 0.3f, 0.1f);
// -0.5f, 0.5f, 1.0f, 0.0f, 0.0f, createCenterRect((GLfloat*)&triangleVertices[3], 0.0f, -0.8f, 0.5f, 0.1f);
// -0.5f, -0.5f, 0.0f, 1.0f, 0.0f,
// -0.75f, -0.5f, 0.0f, 0.0f, 1.0f,
// -0.5f, 0.5f, 1.0f, 0.0f, 0.0f,
// -0.75f, 0.5f, 0.0f, 1.0f, 0.0f,
// -0.75f, -0.5f, 0.0f, 0.0f, 1.0f
// };
GLfloat triangleVertices[48];
createCenterRect(&triangleVertices[0], -0.2f, 0.0f, 0.1f, 1.2f);
createCenterRect(&triangleVertices[12], 0.2f, 0.0f, 0.1f, 1.2f);
createCenterRect(&triangleVertices[24], 0.0f, 0.0f, 0.3f, 0.1f);
createCenterRect(&triangleVertices[36], 0.0f, -0.8f, 0.5f, 0.1f);
GLuint triangleVertexBufferObject; GLuint triangleVertexBufferObject;