gpuray_glsl
diff src/rend.cc @ 4:2ed3da7dc0bc
broken
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 10 Nov 2014 01:26:00 +0200 |
parents | f234630e38ff |
children |
line diff
1.1 --- a/src/rend.cc Sun Nov 09 20:13:33 2014 +0200 1.2 +++ b/src/rend.cc Mon Nov 10 01:26:00 2014 +0200 1.3 @@ -1,4 +1,6 @@ 1.4 +#include <stdio.h> 1.5 #include <assert.h> 1.6 +#include <algorithm> 1.7 #include "scene.h" 1.8 #include "image.h" 1.9 #include "rend.h" 1.10 @@ -10,6 +12,7 @@ 1.11 TEX_SPHERES, 1.12 TEX_PLANES, 1.13 TEX_BOXES, 1.14 + TEX_CONES, 1.15 TEX_TEXTURES, 1.16 TEX_ENV, 1.17 TEX_XFORM, 1.18 @@ -31,6 +34,14 @@ 1.19 { 1.20 scn = s; 1.21 1.22 + int max_tex_units; 1.23 + glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &max_tex_units); 1.24 + printf("maximum texture units: %d\n", max_tex_units); 1.25 + if(NUM_SDR_TEXTURES > max_tex_units) { 1.26 + fprintf(stderr, "not enough texture units available!\n"); 1.27 + return false; 1.28 + } 1.29 + 1.30 glGenTextures(1, textures + TEX_RAYDIR); 1.31 glBindTexture(GL_TEXTURE_2D, textures[TEX_RAYDIR]); 1.32 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 1.33 @@ -46,6 +57,7 @@ 1.34 textures[TEX_SPHERES] = s->get_texture(GPUScene::TEX_SPHERE); 1.35 textures[TEX_PLANES] = s->get_texture(GPUScene::TEX_PLANE); 1.36 textures[TEX_BOXES] = s->get_texture(GPUScene::TEX_BOX); 1.37 + textures[TEX_CONES] = s->get_texture(GPUScene::TEX_CONE); 1.38 textures[TEX_TEXTURES] = s->get_texture(GPUScene::TEX_TEXTURE); 1.39 textures[TEX_ENV] = s->get_texture(GPUScene::TEX_ENV); 1.40 textures[TEX_XFORM] = s->get_texture(GPUScene::TEX_XFORM); 1.41 @@ -74,6 +86,7 @@ 1.42 set_uniform_int(sdr, "tex_spheres", TEX_SPHERES); 1.43 set_uniform_int(sdr, "tex_planes", TEX_PLANES); 1.44 set_uniform_int(sdr, "tex_boxes", TEX_BOXES); 1.45 + set_uniform_int(sdr, "tex_cones", TEX_CONES); 1.46 set_uniform_int(sdr, "tex_megatex", TEX_TEXTURES); 1.47 set_uniform_int(sdr, "tex_env", TEX_ENV); 1.48 set_uniform_int(sdr, "tex_xforms", TEX_XFORM);