Exemple #1
0
void 
realloc_textures(void)
{
    static int first = 1;
    int i;

    if (!first) {
	for (i = 0; i < 6; i++)
	    free(faceMap[i]);
    } else {
	first = 0;
    }

    for (i = 0; i < 6; i++) {
	faceMap[i] = (GLuint *) malloc(faceW * faceW * sizeof(GLuint));
	if (!faceMap[i]) {
	    fprintf(stderr, "malloc of %d bytes failed.\n",
		    faceW * faceW * sizeof(GLuint));
	}
    }

    sphereMap[0] = (GLuint *) malloc(sphereW * sphereW * sizeof(GLuint));
    sphereMap[1] = (GLuint *) malloc(sphereW * sphereW * sizeof(GLuint));
    reset_textures();
}
Exemple #2
0
template <> platform_display_type insert<presets_t>(display_t&             display,
                                                    platform_display_type& parent,
                                                    presets_t&             element)
{
    assert(!element.control_m);

    insert(display, parent, element.category_popup_m);

    insert(display, parent, element.popup_m);

    GG::X width(26);
    GG::Y height(21);
    boost::shared_ptr<GG::StyleFactory> style = GG::GUI::GetGUI()->GetStyleFactory();
    element.control_m = style->NewButton(GG::X0, GG::Y0, width, height,
                                         "", style->DefaultFont(), GG::CLR_GRAY);
    reset_textures(element);

    GG::Connect(element.control_m->ClickedSignal,
                boost::bind(&presets_button_clicked, boost::ref(element)));

    element.popup_m.monitor(boost::bind(&presets_t::do_imbue, boost::ref(element), _1));

    if (!element.alt_text_m.empty())
        adobe::implementation::set_control_alt_text(element.control_m, element.alt_text_m);

    return display.insert(parent, element.control_m);
}
Exemple #3
0
/*ARGSUSED1*/
void 
key(unsigned char key, int x, int y)
{
    static int idle = 1;
    switch (key) {
    case 'a':
    case 'A':
	animate = (animate == 0);
	printf("%sanimating\n", animate ? "" : "not ");
	break;
    case 'd':
    case 'D':
	printf("drawing\n");
	draw();
	break;
    case 'r':
    case 'R':
	printf("resetting sphere maps...\n");
	reset_textures();
	draw();
	break;
    case 't':
    case 'T':
	useSphereMaps = (useSphereMaps == 0);
	printf("%s using sphere maps\n", useSphereMaps ? "" : "not ");
	break;
    case 27:
	exit(0);
    default:
	if (idle) {
	    glutIdleFunc(0);
	} else {
	    glutIdleFunc(draw);
	}
	idle = (idle == 0);
	printf("%sdrawing when idle\n", idle ? "" : "not ");
	break;
    }
}
Exemple #4
0
void enable(presets_t& control, bool enable)
{
    assert(control.control_m);
    control.control_m->Disable(!enable);
    reset_textures(control);
}