@Override public Texture load (String fileName) { Texture result = new Texture(Gdx.files.internal(fileName), useMipMaps); result.setFilter(minFilter, magFilter); result.setWrap(uWrap, vWrap); return result; } }
@Override public Texture load (String fileName) { Texture result = new Texture(Gdx.files.internal(fileName), useMipMaps); result.setFilter(minFilter, magFilter); result.setWrap(uWrap, vWrap); return result; } }
@Override protected Texture createTexture (FrameBufferTextureAttachmentSpec attachmentSpec) { GLOnlyTextureData data = new GLOnlyTextureData(bufferBuilder.width, bufferBuilder.height, 0, attachmentSpec.internalFormat, attachmentSpec.format, attachmentSpec.type); Texture result = new Texture(data); result.setFilter(TextureFilter.Linear, TextureFilter.Linear); result.setWrap(TextureWrap.ClampToEdge, TextureWrap.ClampToEdge); return result; }
@Override protected Texture createTexture (FrameBufferTextureAttachmentSpec attachmentSpec) { GLOnlyTextureData data = new GLOnlyTextureData(bufferBuilder.width, bufferBuilder.height, 0, attachmentSpec.internalFormat, attachmentSpec.format, attachmentSpec.type); Texture result = new Texture(data); result.setFilter(TextureFilter.Linear, TextureFilter.Linear); result.setWrap(TextureWrap.ClampToEdge, TextureWrap.ClampToEdge); return result; }
@Override public Texture loadSync (AssetManager manager, String fileName, FileHandle file, TextureParameter parameter) { if (info == null) return null; Texture texture = info.texture; if (texture != null) { texture.load(info.data); } else { texture = new Texture(info.data); } if (parameter != null) { texture.setFilter(parameter.minFilter, parameter.magFilter); texture.setWrap(parameter.wrapU, parameter.wrapV); } return texture; }
@Override public Texture loadSync (AssetManager manager, String fileName, FileHandle file, TextureParameter parameter) { if (info == null) return null; Texture texture = info.texture; if (texture != null) { texture.load(info.data); } else { texture = new Texture(info.data); } if (parameter != null) { texture.setFilter(parameter.minFilter, parameter.magFilter); texture.setWrap(parameter.wrapU, parameter.wrapV); } return texture; }
@Override protected Texture createTexture (FrameBufferTextureAttachmentSpec attachmentSpec) { FloatTextureData data = new FloatTextureData( bufferBuilder.width, bufferBuilder.height, attachmentSpec.internalFormat, attachmentSpec.format, attachmentSpec.type, attachmentSpec.isGpuOnly ); Texture result = new Texture(data); if (Gdx.app.getType() == ApplicationType.Desktop || Gdx.app.getType() == ApplicationType.Applet) result.setFilter(TextureFilter.Linear, TextureFilter.Linear); else // no filtering for float textures in OpenGL ES result.setFilter(TextureFilter.Nearest, TextureFilter.Nearest); result.setWrap(TextureWrap.ClampToEdge, TextureWrap.ClampToEdge); return result; }
@Override protected Texture createTexture (FrameBufferTextureAttachmentSpec attachmentSpec) { FloatTextureData data = new FloatTextureData( bufferBuilder.width, bufferBuilder.height, attachmentSpec.internalFormat, attachmentSpec.format, attachmentSpec.type, attachmentSpec.isGpuOnly ); Texture result = new Texture(data); if (Gdx.app.getType() == ApplicationType.Desktop || Gdx.app.getType() == ApplicationType.Applet) result.setFilter(TextureFilter.Linear, TextureFilter.Linear); else // no filtering for float textures in OpenGL ES result.setFilter(TextureFilter.Nearest, TextureFilter.Nearest); result.setWrap(TextureWrap.ClampToEdge, TextureWrap.ClampToEdge); return result; }
@Override public void create () { Gdx.gl.glEnable(GL20.GL_DEPTH_TEST); Gdx.gl.glDepthFunc(GL20.GL_LESS); egg = new Texture(Gdx.files.internal("data/egg.png")); egg.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear); egg.setWrap(Texture.TextureWrap.ClampToEdge, Texture.TextureWrap.ClampToEdge); wheel = new Texture(Gdx.files.internal("data/wheel.png")); wheel.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear); wheel.setWrap(Texture.TextureWrap.ClampToEdge, Texture.TextureWrap.ClampToEdge); w = Gdx.graphics.getWidth() / 0.8f; h = Gdx.graphics.getHeight() / 0.8f; for (int i = 0; i < INITIAL_RENDERED; i++) { toRender.add(makeDecal()); } cam = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); cam.near = 0.1f; cam.far = 10f; cam.position.set(0, 0, 0.1f); cam.direction.set(0, 0, -1f); batch = new DecalBatch(new CameraGroupStrategy(cam)); Gdx.gl.glClearColor(1, 1, 0, 1); }
public void create () { // Create an empty dynamic pixmap pixmap = new Pixmap(800, 480, Pixmap.Format.RGBA8888); // Pixmap.Format.RGBA8888); // Create a texture to contain the pixmap texture = new Texture(1024, 1024, Pixmap.Format.RGBA8888); // Pixmap.Format.RGBA8888); texture.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Linear); texture.setWrap(Texture.TextureWrap.ClampToEdge, Texture.TextureWrap.ClampToEdge); pixmap.setColor(1.0f, 0.0f, 0.0f, 1.0f); // Red pixmap.drawLine(0, 0, 100, 100); pixmap.setColor(0.0f, 0.0f, 1.0f, 1.0f); // Blue pixmap.drawLine(100, 100, 200, 0); pixmap.setColor(0.0f, 1.0f, 0.0f, 1.0f); // Green pixmap.drawLine(100, 0, 100, 100); pixmap.setColor(1.0f, 1.0f, 1.0f, 1.0f); // White pixmap.drawCircle(400, 300, 100); // Blit the composited overlay to a texture texture.draw(pixmap, 0, 0); region = new TextureRegion(texture, 0, 0, 800, 480); batch = new SpriteBatch(); Pixmap pixmap = new Pixmap(512, 1024, Pixmap.Format.RGBA8888); for (int y = 0; y < pixmap.getHeight(); y++) { // 1024 for (int x = 0; x < pixmap.getWidth(); x++) { // 512 pixmap.getPixel(x, y); } } pixmap.dispose(); }
private static void loadPostProcessorMaps () { postXpro = newTexture("data/base/xpro-lut.png", false); postXpro.setWrap(TextureWrap.ClampToEdge, TextureWrap.ClampToEdge); postLensFlare = newTexture("data/base/lenscolor.png", false); postLensFlare.setWrap(TextureWrap.ClampToEdge, TextureWrap.ClampToEdge); // depthMapGen = ShaderLoader.fromFile( "depth", "depth" ); // depthMapGenTransparent = ShaderLoader.fromFile( "depth-transparent", // "depth-transparent" ); }
/** Regenerates and/or rebinds owned resources when needed, eg. when the OpenGL context is lost. */ public void rebind () { composite.texture1.setWrap(compositeWrapU, compositeWrapV); composite.texture2.setWrap(compositeWrapU, compositeWrapV); for (int i = 0; i < buffers.size; i++) { buffers.get(i).rebind(); } for (PostProcessorEffect e : effectsManager) { e.rebind(); } }
/** Regenerates and/or rebinds owned resources when needed, eg. when the OpenGL context is lost. */ public void rebind () { composite.texture1.setWrap(compositeWrapU, compositeWrapV); composite.texture2.setWrap(compositeWrapU, compositeWrapV); for (int i = 0; i < buffers.size; i++) { buffers.get(i).rebind(); } for (PostProcessorEffect e : effectsManager) { e.rebind(); } }
@Override protected Texture createTexture (FrameBufferTextureAttachmentSpec attachmentSpec) { GLOnlyTextureData data = new GLOnlyTextureData(bufferBuilder.width, bufferBuilder.height, 0, attachmentSpec.internalFormat, attachmentSpec.format, attachmentSpec.type); Texture result = new Texture(data); result.setFilter(TextureFilter.Linear, TextureFilter.Linear); result.setWrap(TextureWrap.ClampToEdge, TextureWrap.ClampToEdge); return result; }
@Override public Texture load (String fileName) { Texture result = new Texture(Gdx.files.absolute(fileName), useMipMaps); result.setFilter(minFilter, magFilter); result.setWrap(uWrap, vWrap); return result; } }
@Override public Texture load (String fileName) { Texture result = new Texture(Gdx.files.internal(fileName), useMipMaps); result.setFilter(minFilter, magFilter); result.setWrap(uWrap, vWrap); return result; } }
private void createPixmap () { Pixmap whitePixmap = new Pixmap(2, 2, Format.RGB888); whitePixmap.setColor(Color.WHITE); whitePixmap.drawRectangle(0, 0, 2, 2); whiteTexture = new Texture(whitePixmap); whiteTexture.setWrap(TextureWrap.Repeat, TextureWrap.Repeat); whitePixmap.dispose(); }