Java Code Examples for android.opengl.GLES20#GL_NEAREST_MIPMAP_NEAREST

The following examples show how to use android.opengl.GLES20#GL_NEAREST_MIPMAP_NEAREST . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TextureParameters.java    From ShaderEditor with MIT License 6 votes vote down vote up
private static int shortcutToMin(String shortcut) {
	switch (shortcut) {
		case "n":
			return GLES20.GL_NEAREST;
		case "l":
			return GLES20.GL_LINEAR;
		case "nn":
			return GLES20.GL_NEAREST_MIPMAP_NEAREST;
		case "ln":
			return GLES20.GL_LINEAR_MIPMAP_NEAREST;
		case "ll":
			return GLES20.GL_LINEAR_MIPMAP_LINEAR;
		default:
			return GLES20.GL_NEAREST_MIPMAP_LINEAR;
	}
}
 
Example 2
Source File: TextureParameters.java    From ShaderEditor with MIT License 6 votes vote down vote up
private static String minToShortcut(int min) {
	switch (min) {
		case GLES20.GL_NEAREST:
			return "n";
		case GLES20.GL_LINEAR:
			return "l";
		case GLES20.GL_NEAREST_MIPMAP_NEAREST:
			return "nn";
		case GLES20.GL_LINEAR_MIPMAP_NEAREST:
			return "ln";
		case GLES20.GL_LINEAR_MIPMAP_LINEAR:
			return "ll";
		default:
			return "nl";
	}
}
 
Example 3
Source File: OGLESShaderRenderer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private int convertMinFilter(Texture.MinFilter filter) {
    switch (filter) {
        case Trilinear:
            return GLES20.GL_LINEAR_MIPMAP_LINEAR;
        case BilinearNearestMipMap:
            return GLES20.GL_LINEAR_MIPMAP_NEAREST;
        case NearestLinearMipMap:
            return GLES20.GL_NEAREST_MIPMAP_LINEAR;
        case NearestNearestMipMap:
            return GLES20.GL_NEAREST_MIPMAP_NEAREST;
        case BilinearNoMipMaps:
            return GLES20.GL_LINEAR;
        case NearestNoMipMaps:
            return GLES20.GL_NEAREST;
        default:
            throw new UnsupportedOperationException("Unknown min filter: " + filter);
    }
}
 
Example 4
Source File: PVRTexture.java    From tilt-game-android with MIT License 5 votes vote down vote up
public PVRTexture(final TextureManager pTextureManager, final PVRTextureFormat pPVRTextureFormat, final IPVRTexturePixelBufferStrategy pPVRTexturePixelBufferStrategy, final TextureOptions pTextureOptions, final ITextureStateListener pTextureStateListener) throws IllegalArgumentException, IOException {
	super(pTextureManager, pPVRTextureFormat.getPixelFormat(), pTextureOptions, pTextureStateListener);
	this.mPVRTexturePixelBufferStrategy = pPVRTexturePixelBufferStrategy;

	InputStream inputStream = null;
	try {
		inputStream = this.getInputStream();
		this.mPVRTextureHeader = new PVRTextureHeader(StreamUtils.streamToBytes(inputStream, PVRTextureHeader.SIZE));
	} finally {
		StreamUtils.close(inputStream);
	}

	if (this.mPVRTextureHeader.getPVRTextureFormat().getPixelFormat() != pPVRTextureFormat.getPixelFormat()) {
		throw new IllegalArgumentException("Other PVRTextureFormat: '" + this.mPVRTextureHeader.getPVRTextureFormat().getPixelFormat() + "' found than expected: '" + pPVRTextureFormat.getPixelFormat() + "'.");
	}

	if (this.mPVRTextureHeader.getPVRTextureFormat().isCompressed()) { // TODO && ! GLHELPER_EXTENSION_PVRTC] ) {
		throw new IllegalArgumentException("Invalid PVRTextureFormat: '" + this.mPVRTextureHeader.getPVRTextureFormat() + "'.");
	}

	if (this.hasMipMaps()) {
		switch (pTextureOptions.mMinFilter) {
			case GLES20.GL_NEAREST_MIPMAP_NEAREST:
			case GLES20.GL_NEAREST_MIPMAP_LINEAR:
			case GLES20.GL_LINEAR_MIPMAP_NEAREST:
			case GLES20.GL_LINEAR_MIPMAP_LINEAR:
				break;
			default:
				if (BuildConfig.DEBUG) {
					Debug.w("This '" + this.getClass().getSimpleName() + "' contains mipmaps, but the provided '" + pTextureOptions.getClass().getSimpleName() + "' don't have MipMaps enabled on the MinFilter!");
				}
		}
	}

	this.mUpdateOnHardwareNeeded = true;
}
 
Example 5
Source File: PVRTexture.java    From 30-android-libraries-in-30-days with Apache License 2.0 5 votes vote down vote up
public PVRTexture(final TextureManager pTextureManager, final PVRTextureFormat pPVRTextureFormat, final IPVRTexturePixelBufferStrategy pPVRTexturePixelBufferStrategy, final TextureOptions pTextureOptions, final ITextureStateListener pTextureStateListener) throws IllegalArgumentException, IOException {
	super(pTextureManager, pPVRTextureFormat.getPixelFormat(), pTextureOptions, pTextureStateListener);
	this.mPVRTexturePixelBufferStrategy = pPVRTexturePixelBufferStrategy;

	InputStream inputStream = null;
	try {
		inputStream = this.getInputStream();
		this.mPVRTextureHeader = new PVRTextureHeader(StreamUtils.streamToBytes(inputStream, PVRTextureHeader.SIZE));
	} finally {
		StreamUtils.close(inputStream);
	}

	if(this.mPVRTextureHeader.getPVRTextureFormat().getPixelFormat() != pPVRTextureFormat.getPixelFormat()) {
		throw new IllegalArgumentException("Other PVRTextureFormat: '" + this.mPVRTextureHeader.getPVRTextureFormat().getPixelFormat() + "' found than expected: '" + pPVRTextureFormat.getPixelFormat() + "'.");
	}

	if(this.mPVRTextureHeader.getPVRTextureFormat().isCompressed()) { // TODO && ! GLHELPER_EXTENSION_PVRTC] ) {
		throw new IllegalArgumentException("Invalid PVRTextureFormat: '" + this.mPVRTextureHeader.getPVRTextureFormat() + "'.");
	}

	if(this.hasMipMaps()) {
		switch(pTextureOptions.mMinFilter){
			case GLES20.GL_NEAREST_MIPMAP_NEAREST:
			case GLES20.GL_NEAREST_MIPMAP_LINEAR:
			case GLES20.GL_LINEAR_MIPMAP_NEAREST:
			case GLES20.GL_LINEAR_MIPMAP_LINEAR:
				break;
			default:
				if(BuildConfig.DEBUG) {
					Debug.w("This '" + this.getClass().getSimpleName() + "' contains mipmaps, but the provided '" + pTextureOptions.getClass().getSimpleName() + "' don't have MipMaps enabled on the MinFilter!");
				}
		}
	}

	this.mUpdateOnHardwareNeeded = true;
}