0.2 Draw axis

This commit is contained in:
PedroEdiaz
2024-09-05 14:48:51 +00:00
parent a2f49afbf4
commit 06e8e9074b
11 changed files with 213 additions and 53 deletions

View File

@@ -7,28 +7,25 @@ struct obj
unsigned int vertex, vao, vbo;
};
void * create_mesh( int * mesh )
void * create_mesh( float * mesh )
{
struct obj * p;
p=malloc(sizeof(struct obj));
p->vertex=(*mesh)/4;
p->vertex=(*mesh)/3;
glGenVertexArrays( 1, &p->vao );
glGenBuffers( 1, &p->vbo );
glBindVertexArray( p->vao );
glBindBuffer( GL_ARRAY_BUFFER, p->vbo );
glBufferData( GL_ARRAY_BUFFER, (p->vertex*4)*sizeof(int), mesh+1,
glBufferData( GL_ARRAY_BUFFER, (p->vertex*3)*sizeof(int), mesh+1,
GL_STATIC_DRAW );
glVertexAttribPointer( 0,3,GL_INT, 0, 4*sizeof(int), NULL );
glVertexAttribPointer( 0,3,GL_FLOAT, 0, 3*sizeof(int), NULL );
glEnableVertexAttribArray(0);
glVertexAttribPointer( 1,1,GL_INT, 0, 4*sizeof(int),
(void*)(3*sizeof(int)) );
glEnableVertexAttribArray(1);
return p;
}