Kevin Jerebica
a176afab7e
source code was taken from my project gravity and modified so I can reuse the renderer in other projects. I will also upgrade it, free it from old bugs, put more effort into learning the math behind rendering, etc.
35 lines
821 B
C
35 lines
821 B
C
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include "include/rendlib.h"
|
|
#include "include/object.h"
|
|
|
|
int main(int argc, char *argv[]) {
|
|
int ret = rendlib_start_window(argc, argv);
|
|
if (ret < 0) {
|
|
fprintf(stderr, "--error: %d\n", ret);
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
struct model *m = load_model("assets/models/sphere.obj");
|
|
if (m == NULL) {
|
|
fprintf(stderr, "--error: loading model\n");
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
struct object *o = create_object(&objects, 100.0f, m);
|
|
if (o == NULL) {
|
|
fprintf(stderr, "--error: creating object\n");
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
ret = rendlib_render();
|
|
if (ret < 0) {
|
|
fprintf(stderr, "--error: %d\n", ret);
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
fprintf(stdout, "--rendering\n");
|
|
|
|
return EXIT_SUCCESS;
|
|
}
|