List of usage examples for org.lwjgl.opengl GL32 glTexImage2DMultisample
public static void glTexImage2DMultisample(@NativeType("GLenum") int target, @NativeType("GLsizei") int samples, @NativeType("GLint") int internalformat, @NativeType("GLsizei") int width, @NativeType("GLsizei") int height, @NativeType("GLboolean") boolean fixedsamplelocations)
From source file:com.samrj.devil.gl.Texture2DMultisample.java
/** * Allocates space on the GPU for an image of the given size and format, but * does not upload any information. Useful for attaching to frame buffers. * //from w w w . j a v a 2 s .co m * @param width The width of the image. * @param height The height of the image. * @param samples * @param format The format of the image. * @param fixedSampleLocations * @return This texture. */ public Texture2DMultisample image(int width, int height, int samples, int format, boolean fixedSampleLocations) { if (width <= 0 || height <= 0) throw new IllegalArgumentException("Illegal image dimensions."); this.width = width; this.height = height; int oldID = tempBind(); GL32.glTexImage2DMultisample(target, samples, format, width, height, fixedSampleLocations); tempUnbind(oldID); setVRAMUsage(TexUtil.getBits(format) * width * height * samples); return getThis(); }
From source file:com.xrbpowered.gl.res.buffers.MultisampleBuffers.java
License:Open Source License
protected void create(int w, int h, int samples, boolean depthBuffer, boolean hdr) { colorMSTexId = GL11.glGenTextures(); GL11.glBindTexture(GL32.GL_TEXTURE_2D_MULTISAMPLE, colorMSTexId); GL32.glTexImage2DMultisample(GL32.GL_TEXTURE_2D_MULTISAMPLE, samples, hdr ? GL30.GL_RGB16F : GL11.GL_RGB, w, h, false);/*from w ww. ja va 2 s . co m*/ GL11.glBindTexture(GL32.GL_TEXTURE_2D_MULTISAMPLE, 0); GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, colorMSTexId, 0); depthMSTexId = 0; if (depthBuffer) { depthMSTexId = GL11.glGenTextures(); GL11.glBindTexture(GL32.GL_TEXTURE_2D_MULTISAMPLE, depthMSTexId); GL32.glTexImage2DMultisample(GL32.GL_TEXTURE_2D_MULTISAMPLE, samples, GL30.GL_DEPTH24_STENCIL8, w, h, false); GL11.glBindTexture(GL32.GL_TEXTURE_2D_MULTISAMPLE, 0); GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT, depthMSTexId, 0); } checkStatus(); GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0); }
From source file:de.fatox.meta.graphics.buffer.MultisampleFBO.java
License:Apache License
/** Override this method in a derived class to set up the backing texture as you like. */ protected int createTexture(FrameBufferTextureAttachmentSpec attachmentSpec) { try {//from w ww .j a va 2s. co m int texture = Gdx.gl.glGenTexture(); Gdx.gl.glBindTexture(GL32.GL_TEXTURE_2D_MULTISAMPLE, texture); GL32.glTexImage2DMultisample(GL32.GL_TEXTURE_2D_MULTISAMPLE, 2, attachmentSpec.internalFormat, getWidth(), getHeight(), true); Gdx.gl.glTexParameterf(texture, GL20.GL_TEXTURE_MIN_FILTER, Texture.TextureFilter.Nearest.getGLEnum()); Gdx.gl.glTexParameterf(texture, GL20.GL_TEXTURE_MAG_FILTER, Texture.TextureFilter.Nearest.getGLEnum()); Gdx.gl.glTexParameterf(texture, GL20.GL_TEXTURE_WRAP_S, Texture.TextureWrap.ClampToEdge.getGLEnum()); Gdx.gl.glTexParameterf(texture, GL20.GL_TEXTURE_WRAP_T, Texture.TextureWrap.ClampToEdge.getGLEnum()); Gdx.gl.glBindTexture(GL32.GL_TEXTURE_2D_MULTISAMPLE, 0); return texture; } catch (Exception e) { e.printStackTrace(); } return -1; }