@Override public Unit onTexture2D(final JCGLTexture2DUsableType t) throws JCGLException { FakeFramebuffers.LOG.debug( "[{}] attach {} at color {}", Integer.valueOf(f_id), t, Integer.valueOf(index)); FakeTextures.checkTexture2D(FakeFramebuffers.this.context, t); final JCGLTextureFormat f = t.textureGetFormat(); JCGLTextureFormats.checkColorRenderableTexture2D(f); return Unit.unit(); }
@Override public AreaInclusiveUnsignedLType area() { return this.t_depth.texture().textureGetArea(); }
NullCheck.notNull(update_area, "Area"); final AreaL texture_area = AreaSizesL.area(t.size()); if (!AreasL.contains(texture_area, update_area)) { final StringBuilder sb = new StringBuilder(128); sb.append(System.lineSeparator()); sb.append(" Texture area: "); sb.append(t.size()); sb.append(System.lineSeparator()); sb.append(" Target area: "); final int bpp = t.format().getBytesPerPixel(); final long size = width * height * (long) bpp;
@Override public Unit onTexture2D(final JCGLTexture2DUsableType t) throws JCGLException { if (LOG.isDebugEnabled()) { LOG.debug( "[{}] attach color {} {}", Integer.valueOf(f_id), Integer.valueOf(index), t); } LWJGL3Textures.checkTexture2D(c, t); final JCGLTextureFormat f = t.format(); JCGLTextureFormats.checkColorRenderableTexture2D(f); GL30.glFramebufferTexture2D( GL30.GL_DRAW_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0 + index, GL11.GL_TEXTURE_2D, t.glName(), 0); return Unit.unit(); }
@Override public Unit onTexture2D(final JCGLTexture2DUsableType t) throws JCGLException { if (LWJGL3Framebuffers.LOG.isDebugEnabled()) { LWJGL3Framebuffers.LOG.debug( "[{}] attach color {} {}", Integer.valueOf(f_id), Integer.valueOf(index), t); } LWJGL3Textures.checkTexture2D(c, t); final JCGLTextureFormat f = t.textureGetFormat(); JCGLTextureFormats.checkColorRenderableTexture2D(f); GL30.glFramebufferTexture2D( GL30.GL_DRAW_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0 + index, GL11.GL_TEXTURE_2D, t.getGLName(), 0); return Unit.unit(); }
NullCheck.notNull(area, "Area"); if (!area.isIncludedIn(t.textureGetArea())) { final String s = String.format( "Target area %s is not included within the texture's area %s", area, t.textureGetArea()); assert s != null; throw new RangeCheckException(s); final int bpp = t.textureGetFormat().getBytesPerPixel(); final long size = width * height * (long) bpp;
@Override public JCGLTexture2DUpdateType getTextureUpdate2D( final JCGLTexture2DUsableType t, final JCGLTLTextureDataType data) { final JCGLTexture2DUpdateType u = JCGLTextureUpdates.newUpdateReplacingAll2D(t); final int tw = (int) t.textureGetWidth(); final int th = (int) t.textureGetHeight(); final long dw = data.getWidth(); final long dh = data.getHeight(); RangeCheck.checkGreaterEqualLong( (long) tw, "Texture width", dw, "Data width"); RangeCheck.checkGreaterEqualLong( (long) th, "Texture height", dh, "Data height"); JCGLTLTextureUpdateProvider.populate( t.textureGetFormat(), data, u.getData(), tw, th); return u; }
update_area.isIncludedIn(texture.textureGetArea()), ignored -> "Update area must be included in texture area"); final int width = (int) update_area.getRangeX().getInterval(); final int height = (int) update_area.getRangeY().getInterval(); final JCGLTextureFormat format = texture.textureGetFormat(); final LWJGL3TextureSpec spec = LWJGL3TextureSpecs.getTextureSpec(format); final ByteBuffer buffer = data.getData(); buffer); switch (texture.textureGetMinificationFilter()) { case TEXTURE_FILTER_LINEAR: case TEXTURE_FILTER_NEAREST:
@Override public Unit onTexture2D(final JCGLTexture2DUsableType t) throws JCGLException { LOG.debug( "[{}] attach {} at color {}", Integer.valueOf(f_id), t, Integer.valueOf(index)); FakeTextures.checkTexture2D(FakeFramebuffers.this.context, t); final JCGLTextureFormat f = t.format(); JCGLTextureFormats.checkColorRenderableTexture2D(f); return Unit.unit(); }
@Test public final void testTexture() { final JCGLContextType c = this.newGL33Context("main", 24, 8); final JCGLInterfaceGL33Type gi = c.contextGetGL33(); final JCGLTexturesType gt = gi.getTextures(); final JCGLTextureUnitAllocatorType tc = JCGLTextureUnitAllocator.newAllocatorWithStack(32, gt.textureGetUnits()); final R2Texture2DType tt = R2SSAONoiseTexture.newNoiseTexture(gt, tc.getRootContext()); final JCGLTexture2DUsableType t = tt.texture(); Assert.assertEquals(64L, t.textureGetWidth()); Assert.assertEquals(64L, t.textureGetWidth()); Assert.assertEquals( JCGLTextureFormat.TEXTURE_FORMAT_RGB_8_3BPP, t.textureGetFormat()); } }
final JCGLTexture2DUsableType map = rt_map.texture(); Assert.assertEquals( map.textureGetArea(), desc.area()); Assert.assertEquals( map.textureGetWrapS(), JCGLTextureWrapS.TEXTURE_WRAP_CLAMP_TO_EDGE); Assert.assertEquals( map.textureGetWrapT(), JCGLTextureWrapT.TEXTURE_WRAP_CLAMP_TO_EDGE); Assert.assertTrue(map.isDeleted());
final AreaL texture_area = AreaSizesL.area(texture.size()); final int height = Math.toIntExact(update_area.height()); final JCGLTextureFormat format = texture.format(); final LWJGL3TextureSpec spec = LWJGL3TextureSpecs.getTextureSpec(format); final ByteBuffer buffer = data.data(); buffer); switch (texture.minificationFilter()) { case TEXTURE_FILTER_LINEAR: case TEXTURE_FILTER_NEAREST:
@Override public JCGLTexture2DUpdateType createTextureUpdate2D( final JCGLTexture2DUsableType t, final JCGLTLTextureDataType data) { final JCGLTexture2DUpdateType u = JCGLTextureUpdates.newUpdateReplacingAll2D(t); final int tw = (int) t.width(); final int th = (int) t.height(); final long dw = data.width(); final long dh = data.height(); RangeCheck.checkGreaterEqualLong( (long) tw, "Texture width", dw, "Data width"); RangeCheck.checkGreaterEqualLong( (long) th, "Texture height", dh, "Data height"); populate( t.format(), data, u.data(), tw, th); return u; }
values.stippleNoiseTexture().texture(); this.noise_uv_scale.set2F( (float) (this.viewport_w / noise.textureGetWidth()), (float) (this.viewport_h / noise.textureGetHeight()));
/** * Create a new update that will replace the entirety of {@code t}. * * @param t The texture * * @return A new update */ public static JCGLTexture2DUpdateType newUpdateReplacingAll2D( final JCGLTexture2DUsableType t) { NullCheck.notNull(t, "Texture"); return newUpdateReplacingArea2D(t, AreaSizesL.area(t.size())); }
@Override public boolean texture2DIsBoundAnywhere(final JCGLTexture2DUsableType texture) throws JCGLException { checkTexture2D(this.context, texture); final int texture_id = texture.glName(); return this.texture_to_units.containsKey(texture_id); }
@Override public boolean texture2DIsBoundAnywhere(final JCGLTexture2DUsableType texture) throws JCGLException { FakeTextures.checkTexture2D(this.context, texture); final int texture_id = texture.getGLName(); return this.texture_to_units.containsKey(texture_id); }
rt_texture.texture(); switch (texture.textureGetMinificationFilter()) { case TEXTURE_FILTER_LINEAR: case TEXTURE_FILTER_NEAREST: {
final AreaInclusiveUnsignedLType depth_area = dt.texture().textureGetArea(); if (!Objects.equals(depth_area, area)) { final StringBuilder sb = new StringBuilder(128); final JCGLTextureFormat format = dt.texture().textureGetFormat(); if (JCGLTextureFormats.isDepthRenderable(format)) { if (JCGLTextureFormats.isStencilRenderable(format)) {
@Override public Unit onTexture2D( final JCGLTexture2DUsableType t) throws JCGLException { if (LWJGL3Framebuffers.LOG.isDebugEnabled()) { LWJGL3Framebuffers.LOG.debug( "[{}] attach depth {}", Integer.valueOf(f_id), t); } final JCGLTextureFormat f = t.textureGetFormat(); LWJGL3Textures.checkTexture2D(c, t); JCGLTextureFormats.checkDepthOnlyRenderableTexture2D(f); GL30.glFramebufferTexture2D( GL30.GL_DRAW_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT, GL11.GL_TEXTURE_2D, t.getGLName(), 0); fb.setDepthAttachment(t, JCGLTextureFormats.getDepthBits(f)); return Unit.unit(); } });