Exemplo n.º 1
0
    /**
     * Update the OpenGL texture parameters. You must bind the texture before
     * calling.
     */
    void glUpdateParamsOfBoundTexture()
    {        
        glTexParameteri(texTarget, GL_TEXTURE_WRAP_S,     glWrap(wrap.x));
        glTexParameteri(texTarget, GL_TEXTURE_WRAP_T,     glWrap(wrap.y));
        glTexParameteri(texTarget, GL_TEXTURE_MAG_FILTER, magFilter == Nearest? GL_NEAREST : GL_LINEAR);
        glTexParameteri(texTarget, GL_TEXTURE_MIN_FILTER, glMinFilter(minFilter, mipFilter));
        glTexParameterf(texTarget, GL_TEXTURE_MAX_LEVEL,  maxLevel);

        if(GLInfo::extensions().EXT_texture_filter_anisotropic)
        {
            glTexParameterf(texTarget, GL_TEXTURE_MAX_ANISOTROPY_EXT, maxAnisotropy);
        }

        LIBGUI_ASSERT_GL_OK();

        flags &= ~ParamsChanged;
    }
Exemplo n.º 2
0
void glTexParameterf (GLenum target, GLenum pname, GLfloat param)
{
	if (!GLImpl.tmus[GLImpl.current_tmu].boundtexture) return;
	if (!GLImpl.tmus[GLImpl.current_tmu].boundtexture->teximg ) return;
	if (target != GL_TEXTURE_2D) return;

	GLImpl.tmus[GLImpl.current_tmu].texparamdirty = TRUE;

	switch (pname)
	{
#if 0
	case GL_TEXTURE_MIN_FILTER:
	case GL_TEXTURE_MAG_FILTER:
		if(pname ==  GL_TEXTURE_MIN_FILTER) {
			GLImpl.tmus[GLImpl.current_tmu].boundtexture->min_filter = getFilteringParam((int) param);
			GLImpl.tmus[GLImpl.current_tmu].boundtexture->min_filter = getFilteringParam((int) param);
		} else {
			GLImpl.tmus[GLImpl.current_tmu].boundtexture->mag_filter = getFilteringParam((int) param);
		}
		break;
#else
		if ((int) param == GL_NEAREST_MIPMAP_NEAREST)
		{
			GLImpl.tmus[GLImpl.current_tmu].boundtexture->min_filter = D3DTEXF_POINT;
			GLImpl.tmus[GLImpl.current_tmu].boundtexture->mip_filter = D3DTEXF_POINT;
		}
		else if ((int) param == GL_LINEAR_MIPMAP_NEAREST)
		{
			GLImpl.tmus[GLImpl.current_tmu].boundtexture->min_filter = D3DTEXF_LINEAR;
			GLImpl.tmus[GLImpl.current_tmu].boundtexture->mip_filter = D3DTEXF_POINT;
		}
		else if ((int) param == GL_NEAREST_MIPMAP_LINEAR)
		{
			GLImpl.tmus[GLImpl.current_tmu].boundtexture->min_filter = D3DTEXF_POINT;
			GLImpl.tmus[GLImpl.current_tmu].boundtexture->mip_filter = D3DTEXF_LINEAR;
		}
		else if ((int) param == GL_LINEAR_MIPMAP_LINEAR)
		{
			GLImpl.tmus[GLImpl.current_tmu].boundtexture->min_filter = D3DTEXF_LINEAR;
			GLImpl.tmus[GLImpl.current_tmu].boundtexture->mip_filter = D3DTEXF_LINEAR;
		}
		else if ((int) param == GL_LINEAR)
		{
			GLImpl.tmus[GLImpl.current_tmu].boundtexture->min_filter = D3DTEXF_LINEAR;
			GLImpl.tmus[GLImpl.current_tmu].boundtexture->mip_filter = D3DTEXF_NONE;
		}
		else
		{
			// GL_NEAREST
			GLImpl.tmus[GLImpl.current_tmu].boundtexture->min_filter = D3DTEXF_POINT;
			GLImpl.tmus[GLImpl.current_tmu].boundtexture->mip_filter = D3DTEXF_NONE;
		}
		break;

	case GL_TEXTURE_MAG_FILTER:
		if ((int) param == GL_LINEAR)
			GLImpl.tmus[GLImpl.current_tmu].boundtexture->mag_filter = D3DTEXF_LINEAR;
		else GLImpl.tmus[GLImpl.current_tmu].boundtexture->mag_filter = D3DTEXF_POINT;
		break;
#endif
	case GL_TEXTURE_WRAP_S:
		GLImpl.tmus[GLImpl.current_tmu].boundtexture->wrap_u = glWrap((int) param);
		break;

	case GL_TEXTURE_WRAP_T:
		GLImpl.tmus[GLImpl.current_tmu].boundtexture->wrap_v = glWrap((int) param);
		break;

	default:
		break;
	}
}