Exemplo n.º 1
0
static void draw_buffer(SmokeDomainSettings *sds, GPUShader *shader, const VolumeSlicer *slicer,
                        const float ob_sizei[3], const float invsize[3], const int num_points, const bool do_fire)
{
	GPUTexture *tex_spec = (do_fire) ? create_flame_spectrum_texture() : NULL;

	GLuint vertex_buffer;
	glGenBuffers(1, &vertex_buffer);
	glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer);
	glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 3 * num_points, &slicer->verts[0][0], GL_STATIC_DRAW);

	bind_shader(sds, shader, tex_spec, do_fire, slicer->min, ob_sizei, invsize);

	glEnableClientState(GL_VERTEX_ARRAY);
	glVertexPointer(3, GL_FLOAT, 0, NULL);

	glDrawArrays(GL_TRIANGLES, 0, num_points);

	glDisableClientState(GL_VERTEX_ARRAY);

	unbind_shader(sds, tex_spec, do_fire);

	/* cleanup */

	glBindBuffer(GL_ARRAY_BUFFER, 0);

	glDeleteBuffers(1, &vertex_buffer);
}
Exemplo n.º 2
0
  void draw(GLProgram &s){
    font->FaceSize(fontsize);
    FTBBox textbox= font->BBox(text.c_str());
    box.pos = pos;
    float w = textbox.Upper().X() - textbox.Lower().X()+padding*2.0;
    float h = textbox.Upper().Y() - textbox.Lower().Y()+ padding*2.0;
    box.size = Vec2f(w,h);
    box.draw(s);
    unbind_shader();
    
    font->FaceSize(fontsize*scale);
      font->Render(text.c_str(),-1,FTPoint( ((pos.x - camera_x)  + padding)*scale + window_width/2, ((pos.y - camera_y)  + padding)*scale+ window_height/2));
    bind_shader(s);

  }