int main() { test_colors(); test_dynamic_array(); test_vectors(); test_physics(); int pixels[] = {0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff}; color pixels2[10000]; for (int i = 0; i < 10000; i++) pixels2[i] = 0xE650E1FF; int window_width = 800; int window_height = 600; init_graphics(); renderer_handle rend = create_window(window_width, window_height, "TEST", 0); texture_handle tex = load_texture_data(rend, pixels, 6, 6); texture_handle tex2 = load_texture_data(rend, pixels2, 100, 100); set_clear_color(rend, get_color(0,0,0,0xFF)); while (SDL_GetTicks() < 10000) { clear(rend); double theta = (double) SDL_GetTicks() / 300; double r = 200 * cos(3*theta/5); int x1 = r*cos(theta) - 3 + window_width/2; int y1 = r*sin(theta) - 3 + window_height/2; int x2 = r*cos(theta + 2*PI/3) - 3 + window_width/2; int y2 = r*sin(theta + 2*PI/3) - 3 + window_height/2; int x3 = r*cos(theta - 2*PI/3) - 3 + window_width/2; int y3 = r*sin(theta - 2*PI/3) - 3 + window_height/2; double scale = .75 - .25 * cos(6*theta/5); int s = 100 * scale; draw(rend, tex2, (window_width - s) / 2, (window_height - s) / 2, -theta, s/2, s/2, 0, 0, scale); draw(rend, tex, x1, y1, 0, 0, 0, 0, 0, 1); draw(rend, tex, x2, y2, 0, 0, 0, 0, 0, 1); draw(rend, tex, x3, y3, 0, 0, 0, 0, 0, 1); show(rend); SDL_Delay(16); } destroy_window(rend); cleanup(); return 0; }
static bool load_textures(void) { unsigned i; if (!cg_shader->luts) return true; glGenTextures(cg_shader->luts, lut_textures); for (i = 0; i < cg_shader->luts; i++) { RARCH_LOG("Loading image from: \"%s\".\n", cg_shader->lut[i].path); struct texture_image img = {0}; if (!texture_image_load(cg_shader->lut[i].path, &img)) { RARCH_ERR("Failed to load picture ...\n"); return false; } load_texture_data(lut_textures[i], &img, cg_shader->lut[i].filter != RARCH_FILTER_NEAREST, gl_wrap_type_to_enum(cg_shader->lut[i].wrap)); texture_image_free(&img); } glBindTexture(GL_TEXTURE_2D, 0); return true; }