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.
 
 
 

53 lines
1.1 KiB

#pragma once
#include "fbo.hpp"
#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>
// Used for the bare points
using GLPoint = moggle::hvector4<GLfloat>;
// Used for rendering a textured quad
struct Vertex {
moggle::vector2<GLfloat> pos;
moggle::vector2<GLfloat> tex;
};
struct App {
size_t W = 128;
size_t H = 128;
size_t N = 1 << 18;
float time = 0;
float p_s = 10.962073;
float p_r = 31.211250;
float p_b = 1.537946;
float p_dt = 0.013040;
float maxf = 500;
App(GLContext & gl_context);
void draw(std::function<void(void)> bind, std::function<void(void)> flush);
void resize(size_t w, size_t h);
private:
moggle::vbo<GLPoint> gl_vbo;
moggle::vao gl_vao;
moggle::vbo<Vertex> gl_quad_vbo;
moggle::vao gl_quad_vao;
moggle::shader_program gl_points_program;
moggle::shader_program gl_texture_program;
moggle::fbo gl_fbo;
cl::Context cl_context;
cl::Device cl_device;
cl::CommandQueue cl_queue;
cl::BufferGL cl_buffer;
cl::Program cl_program;
KernelOp k_update;
cl::Program create_cl_program(std::string file);
};