aboutsummaryrefslogtreecommitdiff
path: root/src/render.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/render.c')
-rw-r--r--src/render.c17
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()