Exemple #1
0
GLFWwindow			*setup_program(t_properties *properties)
{
	static const float	verts[] = {-1, 1, -1, -1, 1, -1, 1, 1};
	static const GLuint	inds[] = {0, 1, 3, 1, 2, 3};
	GLFWwindow			*window;

	properties->width = 1000;
	properties->height = 1000;
	window = make_glfw(properties->width, properties->height);
	glClearColor(0, 0, 0, 1);
	properties->model = vao();
	properties->verts = data_buffer((GLvoid *)verts, sizeof(verts));
	properties->indices = index_buffer((GLvoid *)inds, sizeof(inds));
	vao_add_indices(properties->model, properties->indices);
	vao_add_vdata(properties->model, properties->verts, 2, GL_FALSE);
	ft_putnbr(glGetError());
	ft_putendl(" -0");
	properties->shaders[0] = load_vertex();
	properties->shaders[1] = load_fragment(properties->map);
	properties->program = shader_program(properties->shaders, 2);
	ft_putnbr(glGetError());
	ft_putendl(" -1");
	glUseProgram(properties->program);
	glBindVertexArray(properties->model);
	glEnableVertexAttribArray(0);
	init_uniforms(properties->program);
	return (window);
}
Exemple #2
0
void scm_scene::set_frag(const std::string &s)
{
    frag_file = s;

    glsl_delete(&render);

    if (!vert_file.empty() && !frag_file.empty())
        glsl_source(&render, vert_file.c_str(), -1, frag_file.c_str(), -1);

    init_uniforms();
}
Exemple #3
0
// support functions
void config::

init(float aspect_ratio) {

   glEnable(GL_MULTISAMPLE_ARB);
   glClearColor(0.0,0.0,0.0,0.0);

   aspect_ratio_ = aspect_ratio;

   init_programs();
   init_uniforms();
}