diff options
author | Leonard Kugis <leonardkugis@gmail.com> | 2018-01-27 02:03:31 +0100 |
---|---|---|
committer | Leonard Kugis <leonardkugis@gmail.com> | 2018-01-27 02:03:31 +0100 |
commit | c8a38bd8ad66eb0b35f08a4733fdee37a888b83c (patch) | |
tree | 63f730553e879f5e14f0dc5e3cbb92ce771ae43f /src/render.c | |
parent | 3d162bbcc92b22e6b00ee80194214c393770adb7 (diff) |
OpenCL rendering added, not working properly
Diffstat (limited to 'src/render.c')
-rw-r--r-- | src/render.c | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/src/render.c b/src/render.c index b9ad5e0..191dcd9 100644 --- a/src/render.c +++ b/src/render.c @@ -21,6 +21,24 @@ void init_render(Config *config) glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH); glutCreateWindow("Renderer"); + 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); + + _config->config_cpu.tex = tex; + _config->config_opencl.tex = tex; + _config->config_cpu.zoom_func = zoom_func; + _config->config_opencl.zoom_func = zoom_func; + switch(_config->mode) { case MODE_CPU: @@ -35,17 +53,6 @@ void init_render(Config *config) break; } - 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(); } @@ -54,3 +61,8 @@ void show_render() { } + +d64 zoom_func(d64 ft, d64 s) +{ + return (s - expl(-ft)); +} |