clray

diff src/clray.cc @ 32:4cf4919c3812

performance sucks
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 24 Aug 2010 05:43:57 +0100
parents 353d80127627
children a218551293ad
line diff
     1.1 --- a/src/clray.cc	Sun Aug 22 00:50:47 2010 +0100
     1.2 +++ b/src/clray.cc	Tue Aug 24 05:43:57 2010 +0100
     1.3 @@ -26,7 +26,7 @@
     1.4  static float cam_theta, cam_phi = 25.0;
     1.5  static float cam_dist = 10.0;
     1.6  
     1.7 -static bool dbg_glrender = true;
     1.8 +static bool dbg_glrender = false;
     1.9  static bool dbg_show_kdtree = false;
    1.10  static bool dbg_show_obj = true;
    1.11  
    1.12 @@ -107,6 +107,12 @@
    1.13  	}
    1.14  	atexit(cleanup);
    1.15  
    1.16 +	unsigned int *test_pattern = new unsigned int[xsz * ysz];
    1.17 +	for(int i=0; i<ysz; i++) {
    1.18 +		for(int j=0; j<xsz; j++) {
    1.19 +			test_pattern[i * xsz + j] = ((i >> 4) & 1) == ((j >> 4) & 1) ? 0xff0000 : 0xff00;
    1.20 +		}
    1.21 +	}
    1.22  
    1.23  	/*glGenTextures(1, &tex);
    1.24  	glBindTexture(GL_TEXTURE_2D, tex);*/
    1.25 @@ -114,7 +120,8 @@
    1.26  	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
    1.27  	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    1.28  	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    1.29 -	glTexImage2D(GL_TEXTURE_2D, 0, 4, xsz, ysz, 0, GL_RGBA, GL_FLOAT, 0);
    1.30 +	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, xsz, ysz, 0, GL_RGBA, GL_UNSIGNED_BYTE, test_pattern);
    1.31 +	delete [] test_pattern;
    1.32  
    1.33  	glutMainLoop();
    1.34  	return 0;