Esempio n. 1
0
// Clear OSD background
void COMMON_clearbackground(int32_t numcols, int32_t numrows)
{
    UNREFERENCED_PARAMETER(numcols);

# ifdef USE_OPENGL
    if (getrendermode() >= REND_POLYMOST && qsetmode==200)
    {
//        bglPushAttrib(GL_FOG_BIT);
        bglDisable(GL_FOG);

        setpolymost2dview();
        bglColor4f(0.f, 0.f, 0.f, 0.67f);
        bglEnable(GL_BLEND);
        bglRecti(0, 0, xdim, 8*numrows+8);
        bglColor4f(0.f, 0.f, 0.f, 1.f);
        bglRecti(0, 8*numrows+4, xdim, 8*numrows+8);

//        bglPopAttrib();
        bglEnable(GL_FOG);

        return;
    }
# endif

    CLEARLINES2D(0, min(ydim, numrows*8+8), editorcolors[16]);
}
Esempio n. 2
0
void baselayer_setupopengl()
{
	char *p,*p2,*p3;
	static int warnonce = 0;
	int i;

	bglEnable(GL_TEXTURE_2D);
	bglShadeModel(GL_SMOOTH); //GL_FLAT
	bglClearColor(0,0,0,0.5); //Black Background
	bglHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST); //Use FASTEST for ortho!
	bglHint(GL_LINE_SMOOTH_HINT,GL_NICEST);
	bglDisable(GL_DITHER);

	glinfo.vendor     = bglGetString(GL_VENDOR);
	glinfo.renderer   = bglGetString(GL_RENDERER);
	glinfo.version    = bglGetString(GL_VERSION);
	glinfo.extensions = bglGetString(GL_EXTENSIONS);
	
	glinfo.maxanisotropy = 1.0;
	glinfo.bgra = 0;
	glinfo.texcompr = 0;
	
	// process the extensions string and flag stuff we recognize
	p = strdup(glinfo.extensions);
	p3 = p;
	while ((p2 = Bstrtoken(p3 == p ? p : NULL, " ", (char **) &p3, 1)) != NULL) {
		if (!Bstrcmp(p2, "GL_EXT_texture_filter_anisotropic")) {
				// supports anisotropy. get the maximum anisotropy level
			bglGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &glinfo.maxanisotropy);
		} else if (!Bstrcmp(p2, "GL_EXT_texture_edge_clamp") ||
			   !Bstrcmp(p2, "GL_SGIS_texture_edge_clamp")) {
				// supports GL_CLAMP_TO_EDGE or GL_CLAMP_TO_EDGE_SGIS
			glinfo.clamptoedge = 1;
		} else if (!Bstrcmp(p2, "GL_EXT_bgra")) {
				// support bgra textures
			glinfo.bgra = 1;
		} else if (!Bstrcmp(p2, "GL_ARB_texture_compression")) {
				// support texture compression
			glinfo.texcompr = 1;
		} else if (!Bstrcmp(p2, "GL_ARB_texture_non_power_of_two")) {
				// support non-power-of-two texture sizes
			glinfo.texnpot = 1;
		} else if (!Bstrcmp(p2, "WGL_3DFX_gamma_control")) {
				// 3dfx cards have issues with fog
			glinfo.hack_nofog = 1;
			if (!(warnonce&1)) initprintf("3dfx card detected: OpenGL fog disabled\n");
			warnonce |= 1;
		} else if (!Bstrcmp(p2, "GL_ARB_multisample")) {
				// supports multisampling
			glinfo.multisample = 1;
		} else if (!Bstrcmp(p2, "GL_NV_multisample_filter_hint")) {
				// supports nvidia's multisample hint extension
			glinfo.nvmultisamplehint = 1;
		} else if (!strcmp(p2, "GL_ARB_multitexture")) {
			glinfo.multitex = 1;
		} else if (!strcmp(p2, "GL_ARB_texture_env_combine")) {
			glinfo.envcombine = 1;
		}
	}
	free(p);
}