Login  Register

Re: JOCL texture generation

Posted by fifty on Mar 15, 2014; 10:35pm
URL: https://forum.jogamp.org/JOCL-texture-generation-tp4031853p4031923.html

Thanks again.
Just to make sure, the source once again
DemoViewer.java

CL program
__kernel void function (__write_only image2d_t store, unsigned w, unsigned h ) 
{ 
    unsigned  x = get_global_id(0); 
    float     aspect = h/(float)w;  
    int2 ic;      
    ic.s0 = x;    
    uint4  color; 
    color.s012 = 0; 
    color.s3 = 255;                     
    // clear image                      
    for (uint y=0; y<h; ++y) {           
        ic.s1 = y;                       
        write_imageui(store, ic, color); 
    }                                   
    // set red pixel on diagonal (no anti-aliasing) 
    color.s0 = 255;       
    ic.s1      = x*aspect;   
    write_imageui(store, ic, color); 
}