示例#1
0
indexbuffer_t device_create_indexbuffer(device_t device,
		enum gs_index_type type, void *indices, size_t num,
		uint32_t flags)
{
	struct gs_index_buffer *ib = bzalloc(sizeof(struct gs_index_buffer));
	size_t width = type == GS_UNSIGNED_LONG ? sizeof(long) : sizeof(short);

	ib->device  = device;
	ib->data    = indices;
	ib->dynamic = flags & GS_DYNAMIC;
	ib->num     = num;
	ib->width   = width;
	ib->size    = width * num;
	ib->type    = type;
	ib->gl_type = type == GS_UNSIGNED_LONG ? GL_UNSIGNED_INT :
	                                         GL_UNSIGNED_SHORT;

	if (!init_ib(ib)) {
		blog(LOG_ERROR, "device_create_indexbuffer (GL) failed");
		indexbuffer_destroy(ib);
		return NULL;
	}

	return ib;
}
示例#2
0
文件: core.c 项目: jgan42/fractol
static int	button_press(int button, int y, int x, t_fol *f)
{
	if (button == 2)
		f->j_mod = (f->j_mod == 0 ? 1 : 0);
	if ((button == 4 && f->zoom < 8000000000000000) || button == 5)
	{
		if (button == 5)
			f->zoom /= 1.1;
		f->mid.x += f->curs.x * f->zoom * (button == 5 ? 0.1 : -0.1);
		f->mid.y += f->curs.y * f->zoom * (button == 5 ? 0.1 : -0.1);
		if (button == 4)
			f->zoom *= 1.1;
		f->i_max = f->type == 'b' || f->type == 'B' ? 50 : 100;
		init_it(f);
		init_ib(f);
	}
	return (x + y);
}
示例#3
0
文件: main.c 项目: jgan42/fractol
int			init_fractol(t_fol *f)
{
	f->zoom = WIN_H / 3;
	f->mid.x = f->type == 'j' ? WIN_H / 2 : 2 * WIN_H / 3;
	f->mid.y = WIN_W / 2;
	f->ud = 0;
	f->lr = 0;
	f->zoom_io = 0;
	f->color = 0;
	f->j_param.x = 0;
	f->j_param.y = 0;
	f->i_max = f->type == 'b' || f->type == 'B' ? 50 : 100;
	f->j_mod = 0;
	f->i_mod = 0;
	f->b_max = 0;
	f->b_max1 = 0;
	f->b_max2 = 0;
	f->i_min = 0;
	f->power = 2;
	init_it(f);
	init_ib(f);
	return (1);
}
示例#4
0
int rdma_library_init(void)
{
    memset(&rdma_ib_device, 0, sizeof(rdma_ib_device));
    init_ib();
    return 0;
}