Пример #1
0
void 
shader_drawbuffer(struct render_buffer * rb, float tx, float ty, float scale) {
	rs_commit();

	RID glid = texture_glid(rb->texid);
	if (glid == 0)
		return;
	shader_texture(glid, 0);
	render_set(RS->R, VERTEXBUFFER, rb->vbid, 0);

	float sx = scale;
	float sy = scale;
	screen_trans(&sx, &sy);
	screen_trans(&tx, &ty);
	float v[4] = { sx, sy, tx, ty };

	// we should call shader_adduniform to add "st" uniform first
	shader_setuniform(PROGRAM_RENDERBUFFER, 0, UNIFORM_FLOAT4, v);

	shader_program(PROGRAM_RENDERBUFFER, NULL);
	RS->drawcall++;

	renderbuffer_commit(rb);

	render_set(RS->R, VERTEXBUFFER, RS->vertex_buffer, 0);
}
Пример #2
0
static void
rs_commit() {
	struct render_buffer * rb = &(RS->vb);
	if (rb->object == 0)
		return;
	RS->drawcall++;
	struct render *R = RS->R;
	render_buffer_update(R, RS->vertex_buffer, rb->vb, 4 * rb->object);
	renderbuffer_commit(rb);

	rb->object = 0;
}
Пример #3
0
static void
rs_commit() {
	struct render_buffer * rb = &(RS->vb);
	if (rb->object == 0)
		return;
	RS->drawcall++;
	glBindBuffer(GL_ARRAY_BUFFER, RS->vertex_buffer);
	glBufferData(GL_ARRAY_BUFFER, sizeof(struct quad) * rb->object, rb->vb, GL_DYNAMIC_DRAW);

	renderbuffer_commit(rb);

	rb->object = 0;
}
Пример #4
0
void 
shader_drawbuffer(struct render_buffer * rb, float tx, float ty, float scale) {
	rs_commit();
	int glid = texture_glid(rb->texid);
	if (glid == 0)
		return;
	shader_texture(glid);
	shader_program(PROGRAM_RENDERBUFFER);
	RS->drawcall++;
	glBindBuffer(GL_ARRAY_BUFFER, rb->vbid);

	float sx = scale;
	float sy = scale;
	screen_trans(&sx, &sy);
	screen_trans(&tx, &ty);
	struct program *p = &RS->program[RS->current_program];
	glUniform4f(p->st, sx, sy, tx, ty);

	renderbuffer_commit(rb);
}