Rendering depth to texture arrays.
This commit is contained in:
parent
4162fb9447
commit
c6143ae640
@ -58,6 +58,7 @@ public interface GL3 extends GL2 {
|
|||||||
public void glBindFragDataLocation(int param1, int param2, String param3); /// GL3+
|
public void glBindFragDataLocation(int param1, int param2, String param3); /// GL3+
|
||||||
public void glBindVertexArray(int param1); /// GL3+
|
public void glBindVertexArray(int param1); /// GL3+
|
||||||
public void glDeleteVertexArrays(IntBuffer arrays); /// GL3+
|
public void glDeleteVertexArrays(IntBuffer arrays); /// GL3+
|
||||||
|
public void glFramebufferTextureLayer(int param1, int param2, int param3, int param4, int param5); /// GL3+
|
||||||
public void glGenVertexArrays(IntBuffer param1); /// GL3+
|
public void glGenVertexArrays(IntBuffer param1); /// GL3+
|
||||||
public String glGetString(int param1, int param2); /// GL3+
|
public String glGetString(int param1, int param2); /// GL3+
|
||||||
}
|
}
|
||||||
|
@ -94,4 +94,10 @@ public class GLDebugDesktop extends GLDebugES implements GL2, GL3, GL4 {
|
|||||||
gl4.glPatchParameter(count);
|
gl4.glPatchParameter(count);
|
||||||
checkError();
|
checkError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void glFramebufferTextureLayer(int param1, int param2, int param3, int param4, int param5) {
|
||||||
|
gl3.glFramebufferTextureLayer(param1, param2, param3, param4, param5);
|
||||||
|
checkError();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1442,11 +1442,19 @@ public final class GLRenderer implements Renderer {
|
|||||||
setupTextureParams(0, tex);
|
setupTextureParams(0, tex);
|
||||||
}
|
}
|
||||||
|
|
||||||
glfbo.glFramebufferTexture2DEXT(GLFbo.GL_FRAMEBUFFER_EXT,
|
if (rb.getLayer() < 0){
|
||||||
convertAttachmentSlot(rb.getSlot()),
|
glfbo.glFramebufferTexture2DEXT(GLFbo.GL_FRAMEBUFFER_EXT,
|
||||||
convertTextureType(tex.getType(), image.getMultiSamples(), rb.getFace()),
|
convertAttachmentSlot(rb.getSlot()),
|
||||||
image.getId(),
|
convertTextureType(tex.getType(), image.getMultiSamples(), rb.getFace()),
|
||||||
0);
|
image.getId(),
|
||||||
|
0);
|
||||||
|
} else {
|
||||||
|
gl3.glFramebufferTextureLayer(GLFbo.GL_FRAMEBUFFER_EXT,
|
||||||
|
convertAttachmentSlot(rb.getSlot()),
|
||||||
|
image.getId(),
|
||||||
|
0,
|
||||||
|
rb.getLayer());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateFrameBufferAttachment(FrameBuffer fb, RenderBuffer rb) {
|
public void updateFrameBufferAttachment(FrameBuffer fb, RenderBuffer rb) {
|
||||||
|
@ -55,7 +55,7 @@ public enum VarType {
|
|||||||
TextureBuffer(false,true,"sampler1D|sampler1DShadow"),
|
TextureBuffer(false,true,"sampler1D|sampler1DShadow"),
|
||||||
Texture2D(false,true,"sampler2D|sampler2DShadow"),
|
Texture2D(false,true,"sampler2D|sampler2DShadow"),
|
||||||
Texture3D(false,true,"sampler3D"),
|
Texture3D(false,true,"sampler3D"),
|
||||||
TextureArray(false,true,"sampler2DArray"),
|
TextureArray(false,true,"sampler2DArray|sampler2DArrayShadow"),
|
||||||
TextureCubeMap(false,true,"samplerCube"),
|
TextureCubeMap(false,true,"samplerCube"),
|
||||||
Int("int");
|
Int("int");
|
||||||
|
|
||||||
|
@ -97,6 +97,7 @@ public class FrameBuffer extends NativeObject {
|
|||||||
int id = -1;
|
int id = -1;
|
||||||
int slot = SLOT_UNDEF;
|
int slot = SLOT_UNDEF;
|
||||||
int face = -1;
|
int face = -1;
|
||||||
|
int layer = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The image format of the render buffer.
|
* @return The image format of the render buffer.
|
||||||
@ -160,6 +161,10 @@ public class FrameBuffer extends NativeObject {
|
|||||||
return "BufferTarget[format=" + format + "]";
|
return "BufferTarget[format=" + format + "]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getLayer() {
|
||||||
|
return this.layer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -332,9 +337,9 @@ public class FrameBuffer extends NativeObject {
|
|||||||
*
|
*
|
||||||
* @param tex The color texture array to set.
|
* @param tex The color texture array to set.
|
||||||
*/
|
*/
|
||||||
public void setColorTexture(TextureArray tex){
|
public void setColorTexture(TextureArray tex, int layer){
|
||||||
clearColorTargets();
|
clearColorTargets();
|
||||||
addColorTexture(tex);
|
addColorTexture(tex, layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -391,7 +396,7 @@ public class FrameBuffer extends NativeObject {
|
|||||||
*
|
*
|
||||||
* @param tex The texture array to add.
|
* @param tex The texture array to add.
|
||||||
*/
|
*/
|
||||||
public void addColorTexture(TextureArray tex) {
|
public void addColorTexture(TextureArray tex, int layer) {
|
||||||
if (id != -1)
|
if (id != -1)
|
||||||
throw new UnsupportedOperationException("FrameBuffer already initialized.");
|
throw new UnsupportedOperationException("FrameBuffer already initialized.");
|
||||||
|
|
||||||
@ -402,6 +407,7 @@ public class FrameBuffer extends NativeObject {
|
|||||||
colorBuf.slot = colorBufs.size();
|
colorBuf.slot = colorBufs.size();
|
||||||
colorBuf.tex = tex;
|
colorBuf.tex = tex;
|
||||||
colorBuf.format = img.getFormat();
|
colorBuf.format = img.getFormat();
|
||||||
|
colorBuf.layer = layer;
|
||||||
|
|
||||||
colorBufs.add(colorBuf);
|
colorBufs.add(colorBuf);
|
||||||
}
|
}
|
||||||
@ -449,7 +455,20 @@ public class FrameBuffer extends NativeObject {
|
|||||||
depthBuf.tex = tex;
|
depthBuf.tex = tex;
|
||||||
depthBuf.format = img.getFormat();
|
depthBuf.format = img.getFormat();
|
||||||
}
|
}
|
||||||
|
public void setDepthTexture(TextureArray tex, int layer){
|
||||||
|
if (id != -1)
|
||||||
|
throw new UnsupportedOperationException("FrameBuffer already initialized.");
|
||||||
|
|
||||||
|
Image img = tex.getImage();
|
||||||
|
checkSetTexture(tex, true);
|
||||||
|
|
||||||
|
depthBuf = new RenderBuffer();
|
||||||
|
depthBuf.slot = img.getFormat().isDepthStencilFormat() ? SLOT_DEPTH_STENCIL : SLOT_DEPTH;
|
||||||
|
depthBuf.tex = tex;
|
||||||
|
depthBuf.format = img.getFormat();
|
||||||
|
depthBuf.layer = layer;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The number of color buffers attached to this texture.
|
* @return The number of color buffers attached to this texture.
|
||||||
*/
|
*/
|
||||||
|
@ -600,4 +600,9 @@ public class JoglGL implements GL, GL2, GL3, GL4 {
|
|||||||
checkLimit(arrays);
|
checkLimit(arrays);
|
||||||
GLContext.getCurrentGL().getGL2ES3().glDeleteVertexArrays(arrays.limit(), arrays);
|
GLContext.getCurrentGL().getGL2ES3().glDeleteVertexArrays(arrays.limit(), arrays);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void glFramebufferTextureLayer(int param1, int param2, int param3, int param4, int param5) {
|
||||||
|
GLContext.getCurrentGL().getGL3().glFramebufferTextureLayer(param1, param2, param3, param4, param5);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -457,4 +457,9 @@ public final class LwjglGL implements GL, GL2, GL3, GL4 {
|
|||||||
checkLimit(arrays);
|
checkLimit(arrays);
|
||||||
ARBVertexArrayObject.glDeleteVertexArrays(arrays);
|
ARBVertexArrayObject.glDeleteVertexArrays(arrays);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void glFramebufferTextureLayer(int param1, int param2, int param3, int param4, int param5) {
|
||||||
|
GL30.glFramebufferTextureLayer(param1, param2, param3, param4, param5);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -486,4 +486,9 @@ public class LwjglGL implements GL, GL2, GL3, GL4 {
|
|||||||
checkLimit(arrays);
|
checkLimit(arrays);
|
||||||
ARBVertexArrayObject.glDeleteVertexArrays(arrays);
|
ARBVertexArrayObject.glDeleteVertexArrays(arrays);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void glFramebufferTextureLayer(int param1, int param2, int param3, int param4, int param5) {
|
||||||
|
GL30.glFramebufferTextureLayer(param1, param2, param3, param4, param5);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user