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.
 
 
 

46 lines
1.1 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>
using Vertex = moggle::hvector4<GLfloat>;
struct App {
size_t W = 128;
size_t H = 128;
size_t N = 1 << 20;
float time = 0;
float wait = 5;
float p_s = 10.962073;
float p_r = 31.211250;
float p_b = 1.537946;
float p_dt = 0.013040;
App(GLContext & gl_context);
void draw();
void resize(size_t w, size_t h);
private:
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::BufferGL cl_buffer;
cl::Program cl_program;
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);
};