Merge: doc -> main

This commit is contained in:
PedroEdiaz
2024-10-02 13:10:08 -06:00
parent 3c9690a2a7
commit d22daff16d
17 changed files with 363 additions and 163 deletions

View File

@@ -1,13 +1,14 @@
#define GL_GLEXT_PROTOTYPES
#include <GL/gl.h>
#include <stdlib.h>
#include "main.h"
struct obj
{
unsigned int vertex, vao, vbo;
};
void * create_mesh( float * mesh )
mesh_t create_mesh( narray_float_t mesh )
{
struct obj * p;
@@ -29,7 +30,7 @@ void * create_mesh( float * mesh )
return p;
}
void destroy_mesh( void * p )
void destroy_mesh( mesh_t p )
{
struct obj * obj ;
obj = p;
@@ -38,10 +39,18 @@ void destroy_mesh( void * p )
free( p );
}
void draw_mesh( void * p )
void draw_mesh( mesh_t p )
{
struct obj * obj=p;
glBindVertexArray( obj->vao );
#ifdef DEBUG
{
int i;
for( i=0; i<obj->vertex;i+=3 )
glDrawArrays(GL_LINE_LOOP, i, 3 );
}
#else
glDrawArrays(GL_TRIANGLES, 0, obj->vertex );
#endif
}