|
@ -58,6 +58,8 @@ struct App { |
|
|
size_t W = 128; |
|
|
size_t W = 128; |
|
|
size_t H = 128; |
|
|
size_t H = 128; |
|
|
|
|
|
|
|
|
|
|
|
float wait = 2; |
|
|
|
|
|
|
|
|
enum { |
|
|
enum { |
|
|
POS_ATTR, |
|
|
POS_ATTR, |
|
|
TEX_ATTR |
|
|
TEX_ATTR |
|
@ -93,7 +95,7 @@ struct App { |
|
|
moggle::gl::active_texture(GL_TEXTURE0); |
|
|
moggle::gl::active_texture(GL_TEXTURE0); |
|
|
moggle::gl::generate_textures(1, &tex); |
|
|
moggle::gl::generate_textures(1, &tex); |
|
|
moggle::gl::bind_texture(GL_TEXTURE_2D, tex); |
|
|
moggle::gl::bind_texture(GL_TEXTURE_2D, tex); |
|
|
moggle::gl::texture_image_2d(GL_TEXTURE_2D, 0, GL_RGBA, W, H, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); |
|
|
moggle::gl::texture_image_2d(GL_TEXTURE_2D, 0, GL_RGBA32F, W, H, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); |
|
|
moggle::gl::texture_parameter_i(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
|
|
moggle::gl::texture_parameter_i(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
|
|
moggle::gl::texture_parameter_i(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
|
|
moggle::gl::texture_parameter_i(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
|
|
return tex; |
|
|
return tex; |
|
@ -157,9 +159,16 @@ struct App { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void draw(){ |
|
|
void draw(){ |
|
|
time += 1/60.0f; |
|
|
auto dt = 1/60.0; |
|
|
|
|
|
time += dt; |
|
|
|
|
|
if(wait > 0) wait -= dt; |
|
|
|
|
|
|
|
|
|
|
|
if(wait <= 0){ |
|
|
|
|
|
for(int i = 0; i < 1; ++i){ |
|
|
|
|
|
cl::checky((*k_update)(*cl_queue, W, H, W, H, *cl_image, *cl_image)); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
cl::checky((*k_update)(*cl_queue, W, H, W, H, *cl_image, *cl_image)); |
|
|
|
|
|
cl::checky(cl_queue->finish()); |
|
|
cl::checky(cl_queue->finish()); |
|
|
|
|
|
|
|
|
moggle::gl::clear_color(0.65f, 0.65f, 0.65f, 1.0f); |
|
|
moggle::gl::clear_color(0.65f, 0.65f, 0.65f, 1.0f); |
|
@ -176,6 +185,8 @@ struct App { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void resize(size_t w, size_t h){ |
|
|
void resize(size_t w, size_t h){ |
|
|
|
|
|
wait = 2; |
|
|
|
|
|
|
|
|
W = w; |
|
|
W = w; |
|
|
H = h; |
|
|
H = h; |
|
|
|
|
|
|
|
|