vec3 aliasing_buffer[SCREEN_HEIGHT][SCREEN_WIDTH]; screen *screen = InitializeSDL(SCREEN_WIDTH/3, SCREEN_HEIGHT/3, FULLSCREEN_MODE); memset(screen->buffer , 0, screen->height * screen->width * sizeof(uint32_t)); memset(depth_buffer , 0, SCREEN_HEIGHT * SCREEN_WIDTH * sizeof(float )); memset(aliasing_buffer, 0, SCREEN_HEIGHT * SCREEN_WIDTH * sizeof(vec3 )); void draw_screen(screen* screen) { for (int y = 0; y < SCREEN_HEIGHT; y+=3) { for (int x = 0; x < SCREEN_WIDTH; x+=3) { vec3 average = (aliasing_buffer[y][x ] + aliasing_buffer[y+1][x ] + aliasing_buffer[y+2][x ] + aliasing_buffer[y][x+1] + aliasing_buffer[y+1][x+1] + aliasing_buffer[y+2][x+1] + aliasing_buffer[y][x+2] + aliasing_buffer[y+1][x+2] + aliasing_buffer[y+2][x+2]) / 9.f; PutPixelSDL(screen, int(x/3), int(y/3), average); } } } if (x >= 0 && x < SCREEN_WIDTH && y >= 0 && y < SCREEN_HEIGHT) { if (p.z_inv > depth_buffer[y][x]) { depth_buffer[y][x] = p.z_inv; aliasing_buffer[y][x] = R; } }