Strange attractors with OpenCL
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 

51 lines
1.2 KiB

#pragma once
#include <moggle/core/gl.hpp>
#include <moggle/core/shader.hpp>
#include <moggle/core/vao.hpp>
#include <moggle/core/vbo.hpp>
#include <cl2.hpp>
#include <NSGLWrapper.hpp>
struct Vertex{
moggle::vector3<GLfloat> position;
moggle::vector2<GLfloat> tex_coord;
};
struct App {
size_t W = 128;
size_t H = 128;
float time = 0;
float wait = 2;
size_t frame = 0;
App(GLContext & gl_context);
void draw();
void resize(size_t w, size_t h);
private:
GLuint gl_image1;
GLuint gl_image2;
moggle::vbo<Vertex> gl_vbo;
moggle::vao gl_vao;
moggle::shader_program gl_program;
cl::Context cl_context;
cl::Device cl_device;
cl::CommandQueue cl_queue;
cl::ImageGL cl_image1;
cl::ImageGL cl_image2;
cl::Program cl_program;
KernelOp k_initialize;
KernelOp k_hblur;
KernelOp k_vblur;
KernelOp k_update;
static moggle::shader_program create_shader_from_files(std::string vertex, std::string fragment);
static moggle::vbo<Vertex> create_vbo(std::vector<Vertex> const & data);
static moggle::vao create_vao(moggle::vbo<Vertex> const & vbo);
static GLuint create_gl_texture(GLsizei width, GLsizei height);
static cl::Context create_shared_cl_context(GLContext & gl_context);
cl::Program create_cl_program(std::string file);
};