can write to any location
This commit is contained in:
+3
-3
@@ -12,10 +12,10 @@
|
||||
#define ANSI_COLOR_RESET "\x1b[0m"
|
||||
|
||||
#define log_debug(format, ...) \
|
||||
fprintf(stderr, ANSI_COLOR_MAGENTA "[DEBUG] " format ANSI_COLOR_RESET \
|
||||
fprintf(stderr, ANSI_COLOR_MAGENTA "[DEBG] " format ANSI_COLOR_RESET \
|
||||
"\n" __VA_OPT__(, ) __VA_ARGS__)
|
||||
#define log_success(format, ...) \
|
||||
fprintf(stdout, ANSI_COLOR_GREEN "[SUCCESS] " format ANSI_COLOR_RESET \
|
||||
fprintf(stdout, ANSI_COLOR_GREEN "[SUCC] " format ANSI_COLOR_RESET \
|
||||
"\n" __VA_OPT__(, ) __VA_ARGS__)
|
||||
#define log_info(format, ...) \
|
||||
fprintf(stdout, "[INFO] " format "\n" __VA_OPT__(, ) __VA_ARGS__)
|
||||
@@ -23,7 +23,7 @@
|
||||
fprintf(stderr, ANSI_COLOR_YELLOW "[WARN] " format ANSI_COLOR_RESET \
|
||||
"\n" __VA_OPT__(, ) __VA_ARGS__)
|
||||
#define log_error(format, ...) \
|
||||
fprintf(stderr, ANSI_COLOR_RED "[ERROR] " format ANSI_COLOR_RESET \
|
||||
fprintf(stderr, ANSI_COLOR_RED "[FAIL] " format ANSI_COLOR_RESET \
|
||||
"\n" __VA_OPT__(, ) __VA_ARGS__)
|
||||
|
||||
#endif
|
||||
+10
-8
@@ -56,17 +56,19 @@ bool init_textures(ShaderProgram *program, Context context) {
|
||||
}
|
||||
|
||||
void init_framebuffers(ShaderProgram *program) {
|
||||
int i;
|
||||
int i, j;
|
||||
|
||||
glGenFramebuffers(BUFFER_COUNT, program->frame_buffers);
|
||||
|
||||
for (i = 0; i < BUFFER_COUNT; i++) {
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, program->frame_buffers[i]);
|
||||
|
||||
// attaches a selected mipmap level or image of a texture object as one of
|
||||
// the logical buffers of the framebuffer object
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
|
||||
program->textures[i], 0);
|
||||
for (j = 0; j < BUFFER_COUNT; j++) {
|
||||
// attaches a selected mipmap level or image of a texture object as one of
|
||||
// the logical buffers of the framebuffer object
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + j,
|
||||
GL_TEXTURE_2D, program->textures[j], 0);
|
||||
}
|
||||
|
||||
// check framebuffer status
|
||||
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
|
||||
@@ -77,6 +79,8 @@ void init_framebuffers(ShaderProgram *program) {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
log_success("Framebuffer %d initialized", i);
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -157,9 +161,7 @@ void init_single_program(ShaderProgram *program, int i, bool output) {
|
||||
}
|
||||
|
||||
ShaderProgram init_program(File fragment_shader, Context context) {
|
||||
int i, j;
|
||||
char uniform_name[32];
|
||||
|
||||
int i;
|
||||
ShaderProgram program = {.error = false,
|
||||
.last_width = context.width,
|
||||
.last_height = context.height};
|
||||
|
||||
Reference in New Issue
Block a user