/* * render.c * * Created on: 15.01.2018 * Author: Superleo1810 */ #include "render.h" #define HAVE_STRUCT_TIMESPEC #include void init_render(Config *config) { s_arr = (u32 *) malloc((_config->width) * (_config->height) * sizeof(u32)); //glutInit(0, NULL); glutInitWindowPosition(0, 0); glutInitWindowSize(_config->width, _config->height); glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH); glutCreateWindow("Renderer"); if (_config->mode) { glutDisplayFunc(render_cpu); glutIdleFunc(idle_cpu); init_cpu(&_config->config_cpu); } else { glutDisplayFunc(render_opencl); glutIdleFunc(idle_opencl); init_opencl(&_config->config_opencl); } glGenTextures(1, &tex); glBindTexture(GL_TEXTURE_2D, tex); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _config->width, _config->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, s_arr); glBindTexture(GL_TEXTURE_2D, 0); //glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _config->width, _config->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, s_arr); glMatrixMode(GL_PROJECTION); glOrtho(0, _config->width, 0, _config->height, -1, 1); glMatrixMode(GL_MODELVIEW); glutMainLoop(); } void show_render() { }