@Override public JCGLTextureUnitType unitContextBindTexture2D( final JCGLTexturesType g, final JCGLTexture2DUsableType t) { NullCheck.notNull(g); NullCheck.notNull(t); if (!this.isCurrent()) { throw new JCGLExceptionTextureUnitContextNotActive( "Context not current"); } this.checkTextureUnitsRequired(this.next + 1); if (JCGLTextureUnitAllocator.LOG.isTraceEnabled()) { JCGLTextureUnitAllocator.LOG.trace("bind {}", t); } final List<JCGLTextureUnitType> us = JCGLTextureUnitAllocator.this.units; final JCGLTextureUnitType u = us.get(this.next); g.texture2DBind(u, t); this.bindings[this.next] = t; ++this.next; return u; }
} else { if (t instanceof JCGLTexture2DUsableType) { this.g3.texture2DBind(this.unit, (JCGLTexture2DUsableType) t); } else if (t instanceof JCGLTextureCubeUsableType) { this.g3.textureCubeBind(this.unit, (JCGLTextureCubeUsableType) t);
u, width, height, format, wrap_s, wrap_t, min_filter, mag_filter); g.texture2DBind(u, t); this.bindings[this.next] = t; ++this.next;
t.texture2DBind(u, ta); t.texture2DBind(u, ta);
t.texture2DBind(u, ta); t.texture2DBind(u, ta);
final List<JCGLTextureUnitType> us = gt.textureGetUnits(); final JCGLTextureUnitType u0 = us.get(0); gt.texture2DBind(u0, up.texture()); gt.texture2DUpdate(u0, up); return (JCGLTexture2DType) up.texture();
final List<JCGLTextureUnitType> us = gt.textureGetUnits(); final JCGLTextureUnitType u0 = us.get(0); gt.texture2DBind(u0, up.getTexture()); gt.texture2DUpdate(u0, up); return (JCGLTexture2DType) up.getTexture();
@Test public final void testFramebufferBindFeedbackTexture() { final Interfaces i = this.getInterfaces("main"); final JCGLFramebuffersType g_fb = i.getFramebuffers(); final JCGLTexturesType g_tx = i.getTextures(); final JCGLFramebufferBuilderType fbb = g_fb.framebufferNewBuilder(); final List<JCGLTextureUnitType> us = g_tx.textureGetUnits(); final JCGLTextureUnitType u0 = us.get(0); final JCGLTexture2DType t = g_tx.texture2DAllocate( u0, 64L, 64L, JCGLTextureFormat.TEXTURE_FORMAT_DEPTH_16_2BPP, JCGLTextureWrapS.TEXTURE_WRAP_REPEAT, JCGLTextureWrapT.TEXTURE_WRAP_REPEAT, JCGLTextureFilterMinification.TEXTURE_FILTER_NEAREST, JCGLTextureFilterMagnification.TEXTURE_FILTER_NEAREST); g_tx.textureUnitUnbind(u0); fbb.attachDepthTexture2D(t); final JCGLFramebufferType fb = g_fb.framebufferAllocate(fbb); g_fb.framebufferDrawUnbind(); g_fb.framebufferDrawBind(fb); this.expected.expect(JCGLExceptionFeedback.class); g_tx.texture2DBind(u0, t); }
@Test public final void testFramebufferBindFeedback() { final Interfaces i = this.getInterfaces("main"); final JCGLFramebuffersType g_fb = i.getFramebuffers(); final JCGLTexturesType g_tx = i.getTextures(); final JCGLFramebufferBuilderType fbb = g_fb.framebufferNewBuilder(); final List<JCGLTextureUnitType> us = g_tx.textureGetUnits(); final JCGLTextureUnitType u0 = us.get(0); final JCGLTexture2DType t = g_tx.texture2DAllocate( u0, 64L, 64L, JCGLTextureFormat.TEXTURE_FORMAT_DEPTH_16_2BPP, JCGLTextureWrapS.TEXTURE_WRAP_REPEAT, JCGLTextureWrapT.TEXTURE_WRAP_REPEAT, JCGLTextureFilterMinification.TEXTURE_FILTER_NEAREST, JCGLTextureFilterMagnification.TEXTURE_FILTER_NEAREST); g_tx.textureUnitUnbind(u0); fbb.attachDepthTexture2D(t); final JCGLFramebufferType fb = g_fb.framebufferAllocate(fbb); g_fb.framebufferDrawUnbind(); g_tx.texture2DBind(u0, t); this.expected.expect(JCGLExceptionFeedback.class); g_fb.framebufferDrawBind(fb); }
@Test public final void testFramebufferBindFeedbackTexture() { final Interfaces i = this.getInterfaces("main"); final JCGLFramebuffersType g_fb = i.getFramebuffers(); final JCGLTexturesType g_tx = i.getTextures(); final JCGLFramebufferBuilderType fbb = g_fb.framebufferNewBuilder(); final List<JCGLTextureUnitType> us = g_tx.textureGetUnits(); final JCGLTextureUnitType u0 = us.get(0); final JCGLTexture2DType t = g_tx.texture2DAllocate( u0, 64L, 64L, JCGLTextureFormat.TEXTURE_FORMAT_DEPTH_16_2BPP, JCGLTextureWrapS.TEXTURE_WRAP_REPEAT, JCGLTextureWrapT.TEXTURE_WRAP_REPEAT, JCGLTextureFilterMinification.TEXTURE_FILTER_NEAREST, JCGLTextureFilterMagnification.TEXTURE_FILTER_NEAREST); g_tx.textureUnitUnbind(u0); fbb.attachDepthTexture2D(t); final JCGLFramebufferType fb = g_fb.framebufferAllocate(fbb); g_fb.framebufferDrawUnbind(); g_fb.framebufferDrawBind(fb); this.expected.expect(JCGLExceptionFeedback.class); g_tx.texture2DBind(u0, t); }
@Test public final void testFramebufferBindFeedback() { final Interfaces i = this.getInterfaces("main"); final JCGLFramebuffersType g_fb = i.getFramebuffers(); final JCGLTexturesType g_tx = i.getTextures(); final JCGLFramebufferBuilderType fbb = g_fb.framebufferNewBuilder(); final List<JCGLTextureUnitType> us = g_tx.textureGetUnits(); final JCGLTextureUnitType u0 = us.get(0); final JCGLTexture2DType t = g_tx.texture2DAllocate( u0, 64L, 64L, JCGLTextureFormat.TEXTURE_FORMAT_DEPTH_16_2BPP, JCGLTextureWrapS.TEXTURE_WRAP_REPEAT, JCGLTextureWrapT.TEXTURE_WRAP_REPEAT, JCGLTextureFilterMinification.TEXTURE_FILTER_NEAREST, JCGLTextureFilterMagnification.TEXTURE_FILTER_NEAREST); g_tx.textureUnitUnbind(u0); fbb.attachDepthTexture2D(t); final JCGLFramebufferType fb = g_fb.framebufferAllocate(fbb); g_fb.framebufferDrawUnbind(); g_tx.texture2DBind(u0, t); this.expected.expect(JCGLExceptionFeedback.class); g_fb.framebufferDrawBind(fb); }
@Override public void onRender(final JCGLInterfaceGL33Type g) { final JCGLArrayObjectsType g_ao = g.arrayObjects(); final JCGLClearType g_c = g.clearing(); final JCGLDrawType g_d = g.drawing(); final JCGLShadersType g_sh = g.shaders(); final JCGLTexturesType g_tex = g.textures(); /* * Clear the window. */ g_c.clear(this.clear); /* * Activate the program, bind the created array object, draw a triangle. */ final List<JCGLTextureUnitType> units = g_tex.textureGetUnits(); final JCGLTextureUnitType u0 = units.get(0); g_tex.texture2DBind(u0, this.texture); g_sh.shaderActivateProgram(this.program); g_sh.shaderUniformPutTexture2DUnit(this.texture_uniform, u0); g_ao.arrayObjectBind(this.array_object); g_d.drawElements(JCGLPrimitives.PRIMITIVE_TRIANGLES); g_ao.arrayObjectUnbind(); g_sh.shaderDeactivateProgram(); }
@Override public void onRender(final JCGLInterfaceGL33Type g) { final JCGLArrayObjectsType g_ao = g.getArrayObjects(); final JCGLClearType g_c = g.getClear(); final JCGLDrawType g_d = g.getDraw(); final JCGLShadersType g_sh = g.getShaders(); final JCGLTexturesType g_tex = g.getTextures(); /** * Clear the window. */ g_c.clear(this.clear); /** * Activate the program, bind the created array object, draw a triangle. */ final List<JCGLTextureUnitType> units = g_tex.textureGetUnits(); final JCGLTextureUnitType u0 = units.get(0); g_tex.texture2DBind(u0, this.texture); g_sh.shaderActivateProgram(this.program); g_sh.shaderUniformPutTexture2DUnit(this.texture_uniform, u0); g_ao.arrayObjectBind(this.array_object); g_d.drawElements(JCGLPrimitives.PRIMITIVE_TRIANGLES); g_ao.arrayObjectUnbind(); g_sh.shaderDeactivateProgram(); }
Assert.assertFalse(t.textureUnitIsBound(u1)); t.texture2DBind(u1, ta); Assert.assertTrue(t.texture2DIsBoundAnywhere(ta)); Assert.assertFalse(t.texture2DIsBound(u0, ta)); Assert.assertTrue(t.textureUnitIsBound(u1)); t.texture2DBind(u0, ta); Assert.assertTrue(t.texture2DIsBoundAnywhere(ta)); Assert.assertTrue(t.texture2DIsBound(u0, ta));
Assert.assertFalse(t.textureUnitIsBound(u1)); t.texture2DBind(u1, ta); Assert.assertTrue(t.texture2DIsBoundAnywhere(ta)); Assert.assertFalse(t.texture2DIsBound(u0, ta)); Assert.assertTrue(t.textureUnitIsBound(u1)); t.texture2DBind(u0, ta); Assert.assertTrue(t.texture2DIsBoundAnywhere(ta)); Assert.assertTrue(t.texture2DIsBound(u0, ta));
Assert.assertFalse(t.textureCubeIsBoundAnywhere(tb)); t.texture2DBind(u0, ta); Assert.assertTrue(t.textureUnitIsBound(u0)); Assert.assertTrue(t.texture2DIsBound(u0, ta));
Assert.assertFalse(t.textureCubeIsBoundAnywhere(tb)); t.texture2DBind(u0, ta); Assert.assertTrue(t.textureUnitIsBound(u0)); Assert.assertTrue(t.texture2DIsBound(u0, ta));