clray

diff rt.cl @ 39:980bc07be868

Implemented OpenGL/OpenCL interop, and removed the texture copy
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 27 Aug 2010 18:30:09 +0100
parents 7d77ded5f890
children 1bcbb53b3505
line diff
     1.1 --- a/rt.cl	Fri Aug 27 02:22:08 2010 +0100
     1.2 +++ b/rt.cl	Fri Aug 27 18:30:09 2010 +0100
     1.3 @@ -80,7 +80,8 @@
     1.4  float4 calc_bary(float4 pt, global const struct Face *face, float4 norm);
     1.5  float mean(float4 v);
     1.6  
     1.7 -kernel void render(global float4 *fb,
     1.8 +
     1.9 +kernel void render(write_only image2d_t fb,
    1.10  		global const struct RendInfo *rinf,
    1.11  		global const struct Face *faces,
    1.12  		global const struct Material *matlib,
    1.13 @@ -124,7 +125,14 @@
    1.14  		}
    1.15  	}
    1.16  
    1.17 -	fb[idx] = pixel;
    1.18 +	int img_x = get_image_width(fb);
    1.19 +
    1.20 +	int2 coord;
    1.21 +	coord.x = idx % img_x;
    1.22 +	coord.y = idx / img_x;
    1.23 +
    1.24 +	write_imagef(fb, coord, pixel);
    1.25 +	//fb[idx] = pixel;
    1.26  }
    1.27  
    1.28  float4 shade(struct Ray ray, struct Scene *scn, const struct SurfPoint *sp)