diff options
author | Leonard Kugis <leonardkugis@gmail.com> | 2018-01-26 15:34:06 +0100 |
---|---|---|
committer | Leonard Kugis <leonardkugis@gmail.com> | 2018-01-26 15:34:06 +0100 |
commit | 3d162bbcc92b22e6b00ee80194214c393770adb7 (patch) | |
tree | 70f7ceeebbfab4e85731c7bdc5df17f7b2b9b3dd /src/render.c | |
parent | 1c3ea27064257d8cf7b9f36b0388b8cf2e94ab08 (diff) |
fixed crash
Diffstat (limited to 'src/render.c')
-rw-r--r-- | src/render.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/render.c b/src/render.c index 69b46e0..b9ad5e0 100644 --- a/src/render.c +++ b/src/render.c @@ -11,24 +11,28 @@ void init_render(Config *config) { + _config = config; s_arr = (u32 *) malloc((_config->width) * (_config->height) * sizeof(u32)); + _config->config_cpu.arr = s_arr; + _config->config_opencl.arr = s_arr; //glutInit(0, NULL); glutInitWindowPosition(0, 0); glutInitWindowSize(_config->width, _config->height); glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH); glutCreateWindow("Renderer"); - if (_config->mode) + switch(_config->mode) { + case MODE_CPU: + init_cpu(&_config->config_cpu); glutDisplayFunc(render_cpu); glutIdleFunc(idle_cpu); - init_cpu(&_config->config_cpu); - } - else - { + break; + case MODE_OPENCL: + init_opencl(&_config->config_opencl); glutDisplayFunc(render_opencl); glutIdleFunc(idle_opencl); - init_opencl(&_config->config_opencl); + break; } glGenTextures(1, &tex); @@ -43,6 +47,7 @@ void init_render(Config *config) glOrtho(0, _config->width, 0, _config->height, -1, 1); glMatrixMode(GL_MODELVIEW); glutMainLoop(); + } void show_render() |