add webgl, clean a bit
This commit is contained in:
parent
780fb5bca6
commit
ca23bc5936
|
@ -0,0 +1,3 @@
|
|||
[submodule "webgl"]
|
||||
path = webgl
|
||||
url = https://git.gaetanbrochard.dev/gbrochar/webgl
|
14
src/run.c
14
src/run.c
|
@ -117,13 +117,6 @@ static void RenderSceneCB(t_env *e)
|
|||
|
||||
static void CreateVertexBuffer(t_env *e)
|
||||
{
|
||||
printf("status of different buffers:\n");
|
||||
printf("vertices len %ld\n", e->object.vertices.ptr);
|
||||
printf("uv len %ld\n", e->object.uvs.ptr);
|
||||
printf("normals len %ld\n", e->object.normals.ptr);
|
||||
printf("vertices indices len %ld\n", e->object.vertices_indices.ptr);
|
||||
printf("uvs indices len %ld\n", e->object.uvs_indices.ptr);
|
||||
printf("normals indices len %ld\n", e->object.normals_indices.ptr);
|
||||
e->is_good = 1;
|
||||
if (!(e->vbo_data = (float *)malloc(e->object.vertices_indices.ptr * 8 * sizeof(float)))) {
|
||||
perror("malloc");
|
||||
|
@ -149,11 +142,9 @@ static void CreateVertexBuffer(t_env *e)
|
|||
e->is_good = 0;
|
||||
}
|
||||
}
|
||||
//printf("bruh\n");
|
||||
glGenBuffers(1, &VBO);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, VBO);
|
||||
glBufferData(GL_ARRAY_BUFFER, e->object.vertices_indices.ptr * 8 * sizeof(float), e->vbo_data, GL_STATIC_DRAW);
|
||||
printf("Buffer created with success !\n");
|
||||
/* glGenBuffers(1, &VBO);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, VBO);
|
||||
glBufferData(GL_ARRAY_BUFFER, e->object.vertices.ptr * sizeof(double), e->object.vertices.data, GL_STATIC_DRAW);
|
||||
|
@ -346,8 +337,7 @@ int run(t_env *e)
|
|||
return (FAILURE);
|
||||
|
||||
/* Create a windowed mode window and its OpenGL context */
|
||||
//glfwWindowHint(GLFW_STEREO, GLFW_TRUE);
|
||||
window = glfwCreateWindow(e->window.width, e->window.height, "Hello World", NULL, NULL);
|
||||
window = glfwCreateWindow(e->window.width, e->window.height, "SC0P", NULL, NULL);
|
||||
glfwSetWindowUserPointer(window, e);
|
||||
glfwSetKeyCallback(window, key_callback);
|
||||
if (!window)
|
||||
|
@ -359,8 +349,6 @@ int run(t_env *e)
|
|||
glfwMakeContextCurrent(window);
|
||||
|
||||
index_count = e->object.vertices_indices.ptr;
|
||||
//printf("%ld\n", e->object.vertices.ptr);
|
||||
//printf("%ld\n", e->object.vertices_indices.ptr);
|
||||
GLenum res = glewInit();
|
||||
if (res != GLEW_OK)
|
||||
{
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Subproject commit bb82f2dd4c32facefce26e26cb8d463fdb717302
|
Loading…
Reference in New Issue