23 s->
c = glGetAttribLocation(s->
program,
"c");
24 glGenVertexArrays(1, &s->
vao);
28 glDeleteVertexArrays(1, &s->
vao);
32 void fpxx_init_do(
struct fpxx_init *s, GLuint *active_count, GLuint *vbo, GLuint query,
int pass,
int width,
int height,
const mpfr_t centerx,
const mpfr_t centery,
const mpfr_t radius,
const mpfr_t refx,
const mpfr_t refy) {
34 mpfr_inits2(mpfr_get_prec(refx), dx, dy, (mpfr_ptr) 0);
35 mpfr_sub(dx, centerx, refx, MPFR_RNDN);
36 mpfr_sub(dy, centery, refy, MPFR_RNDN);
39 *active_count = width * height;
40 glBindVertexArray(s->
vao);
D;
41 glBindBuffer(GL_ARRAY_BUFFER, vbo[0]);
D;
43 glUniform1i(s->
pass, pass);
D;
44 glUniform1d(s->
radius, mpfr_get_d(radius, MPFR_RNDN));
D;
45 glUniform2d(s->
center, mpfr_get_d(dx, MPFR_RNDN), mpfr_get_d(dy, MPFR_RNDN));
D;
46 glUniform1d(s->
aspect, height / (
double) width);
D;
47 glVertexAttribPointer(s->
c, 4, GL_FLOAT, GL_FALSE, 0, 0);
D;
48 glEnableVertexAttribArray(s->
c);
D;
49 glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, vbo[1]);
D;
50 glBeginQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, query);
D;
51 glBeginTransformFeedback(GL_POINTS);
D;
52 glDrawArrays(GL_POINTS, 0, *active_count);
D;
53 glEndTransformFeedback();
D;
54 glEndQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN);
D;
55 int before = *active_count;
56 glGetQueryObjectuiv(query, GL_QUERY_RESULT, active_count);
D;
57 int after = *active_count;
58 debug_message(
"init active_count: %d -> %d\n", before, after);
59 glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, 0);
D;
61 glBindBuffer(GL_ARRAY_BUFFER, 0);
D;
63 mpfr_clears(dx, dy, (mpfr_ptr) 0);