Пример #1
0
/*
 * Find a VisualInfo which matches the given display name and attribute
 * bitmask, or return a pointer to a new visual.
 */
VisualInfo *
renderspuFindVisual(const char *displayName, GLbitfield visAttribs)
{
	int i;

	if (!displayName)
		displayName = "";

	/* first, try to find a match */
#if defined(WINDOWS) || defined(DARWIN)
	for (i = 0; i < render_spu.numVisuals; i++) {
		if (visAttribs == render_spu.visuals[i].visAttribs) {
			return &(render_spu.visuals[i]);
		}
	}
#elif defined(GLX)
	for (i = 0; i < render_spu.numVisuals; i++) {
		if (crStrcmp(displayName, render_spu.visuals[i].displayName) == 0
			&& visAttribs == render_spu.visuals[i].visAttribs) {
			return &(render_spu.visuals[i]);
		}
	}
#endif

	if (render_spu.numVisuals >= MAX_VISUALS)
	{
		crWarning("Render SPU: Couldn't create a visual, too many visuals already");
		return NULL;
	}

	/* create a new visual */
	i = render_spu.numVisuals;
	render_spu.visuals[i].displayName = crStrdup(displayName);
	render_spu.visuals[i].visAttribs = visAttribs;
	if (renderspu_SystemInitVisual(&(render_spu.visuals[i]))) {
		render_spu.numVisuals++;
		return &(render_spu.visuals[i]);
	}
	else {
		crWarning("Render SPU: Couldn't get a visual, renderspu_SystemInitVisual failed");
		return NULL;
	}
}
Пример #2
0
GLboolean renderspuInitVisual(VisualInfo *pVisInfo, const char *displayName, GLbitfield visAttribs)
{
    pVisInfo->displayName = crStrdup(displayName);
    pVisInfo->visAttribs = visAttribs;
    return renderspu_SystemInitVisual(pVisInfo);
}