Exemplo n.º 1
0
void
piglit_framework_glut_init(int argc, char *argv[],
			   const struct piglit_gl_test_info *info)
{
	if (test_info != NULL)
		assert(!"already init");

	test_info = info;
	glutInit(&argc, argv);

#	if defined(USE_WAFFLE)
#		if defined(USE_OPENGL)
			glutInitAPIMask(GLUT_OPENGL_BIT);
#		elif defined(USE_OPENGL_ES1)
			glutInitAPIMask(GLUT_OPENGL_ES1_BIT);
#		elif defined(USE_OPENGL_ES2)
			glutInitAPIMask(GLUT_OPENGL_ES2_BIT);
#		else
#			error
#		endif
#	endif

	glutInitWindowPosition(0, 0);
	glutInitWindowSize(info->window_width,
			info->window_height);
	glutInitDisplayMode(info->window_visual);
	piglit_window = glutCreateWindow(argv[0]);

#if defined(USE_GLX) && !defined(USE_WAFFLE)
	/* If using waffle, then the current platform might not be GLX.
	 * So we can't call any GLX functions.
	 *
	 * FIXME: Detect the waffle platform and handle piglit_automatic
	 * FIXME: appropriately.
	 */
	if (piglit_automatic)
		piglit_glx_set_no_input();
#endif

	glutDisplayFunc(display);
	glutReshapeFunc(reshape);
	glutKeyboardFunc(piglit_escape_exit_key);

#ifdef USE_OPENGL
	glewInit();
#endif
}
Exemplo n.º 2
0
static void
piglit_framework_glut_init(int argc, char *argv[])
{
	piglit_glutInit(argc, argv);

	glutInitWindowPosition(0, 0);
	glutInitWindowSize(piglit_width, piglit_height);
	glutInitDisplayMode(piglit_window_mode);
	piglit_window = glutCreateWindow(argv[0]);

#ifdef USE_GLX
	if (piglit_automatic)
		piglit_glx_set_no_input();
#endif

	glutDisplayFunc(display);
	glutReshapeFunc(reshape);
	glutKeyboardFunc(piglit_escape_exit_key);

#ifdef USE_OPENGL
	glewInit();
#endif
}
Exemplo n.º 3
0
int main(int argc, char**argv)
{
	XVisualInfo *visinfo;
	GLXContext ctx;
	int i;

	for(i = 1; i < argc; ++i) {
		if (!strcmp(argv[i], "-auto"))
			piglit_automatic = 1;
		else
			fprintf(stderr, "Unknown option: %s\n", argv[i]);
	}

	dpy = XOpenDisplay(NULL);
	if (dpy == NULL) {
		fprintf(stderr, "couldn't open display\n");
		piglit_report_result(PIGLIT_FAIL);
	}

	visinfo = piglit_get_glx_visual(dpy);
	ctx = piglit_get_glx_context(dpy, visinfo);
	win = piglit_get_glx_window(dpy, visinfo);
	XFree(visinfo);

	glXMakeCurrent(dpy, win, ctx);

	glewInit();

	if (piglit_automatic)
		piglit_glx_set_no_input();

	XMapWindow(dpy, win);

	piglit_require_glx_extension(dpy, "GLX_EXT_texture_from_pixmap");
	if (!piglit_is_extension_supported("GL_ARB_texture_env_combine")) {
		fprintf(stderr, "Test requires GL_ARB_texture_env_combine\n");
		piglit_report_result(PIGLIT_SKIP);
	}

	pglXBindTexImageEXT = (PFNGLXBINDTEXIMAGEEXTPROC)
		glXGetProcAddress((GLubyte *)"glXBindTexImageEXT");
	pglXReleaseTexImageEXT = (PFNGLXRELEASETEXIMAGEEXTPROC)
		glXGetProcAddress((GLubyte *)"glXReleaseTexImageEXT");
	if (pglXBindTexImageEXT == NULL || pglXReleaseTexImageEXT == NULL) {
		fprintf(stderr, "Couldn't get TFP functions\n");
		piglit_report_result(PIGLIT_FAIL);
		exit(1);
	}

	init();

	if (!piglit_automatic) {
		printf("Left rectangle (RGB) should be green on the top and\n"
		       "red on the bottom.  The right rectangle (RGBA) should\n"
		       "be the same, but darker on the right half.\n");
		printf("Press Escape to quit\n");
	}

	piglit_glx_event_loop(dpy, draw);

	return 0;
}