aboutsummaryrefslogtreecommitdiffstats
path: root/ardor3d-jogl
diff options
context:
space:
mode:
authorJulien Gouesse <[email protected]>2021-08-30 20:43:08 +0200
committerJulien Gouesse <[email protected]>2021-08-30 20:43:08 +0200
commit12e6dd7dcbad20ef0bd573d4b44679d802fa2fdc (patch)
treecff8136985c0f7c793ce7e12b29bfda2098358d4 /ardor3d-jogl
parent6eb68ea594195f5032222ac151570aa63bdedf1f (diff)
Removes the misleading VBO interleaved data mode
Diffstat (limited to 'ardor3d-jogl')
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglRenderer.java200
1 files changed, 0 insertions, 200 deletions
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglRenderer.java b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglRenderer.java
index 7465c7a..9ace782 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglRenderer.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglRenderer.java
@@ -1220,206 +1220,6 @@ public class JoglRenderer extends AbstractRenderer {
}
@Override
- public void setupInterleavedDataVBO(final FloatBufferData interleaved, final FloatBufferData vertexCoords,
- final FloatBufferData normalCoords, final FloatBufferData colorCoords,
- final List<FloatBufferData> textureCoords) {
- final GL gl = GLContext.getCurrentGL();
-
- final RenderContext context = ContextManager.getCurrentContext();
- final RendererRecord rendRecord = context.getRendererRecord();
- final ContextCapabilities caps = context.getCapabilities();
-
- final int lengthBytes = getTotalInterleavedSize(context, vertexCoords, normalCoords, colorCoords,
- textureCoords);
- int currLengthBytes = 0;
- if (interleaved.getBufferLimit() > 0) {
- interleaved.getBuffer().rewind();
- currLengthBytes = Math.round(interleaved.getBuffer().get());
- }
-
- if (lengthBytes != currLengthBytes || interleaved.getVBOID(context.getGlContextRep()) == 0
- || interleaved.isNeedsRefresh()) {
- initializeInterleavedVBO(context, interleaved, vertexCoords, normalCoords, colorCoords, textureCoords,
- lengthBytes);
- }
-
- final int vboID = interleaved.getVBOID(context.getGlContextRep());
- JoglRendererUtil.setBoundVBO(rendRecord, vboID);
-
- int offsetBytes = 0;
-
- if (normalCoords != null) {
- updateVBO(normalCoords, rendRecord, vboID, offsetBytes);
- if (gl.isGL2ES1()) {
- gl.getGL2ES1().glNormalPointer(GL.GL_FLOAT, 0, offsetBytes);
- }
- if (gl.isGL2GL3()) {
- gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_NORMAL_ARRAY);
- }
- offsetBytes += normalCoords.getBufferLimit() * 4;
- } else {
- if (gl.isGL2GL3()) {
- gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_NORMAL_ARRAY);
- }
- }
-
- if (colorCoords != null) {
- updateVBO(colorCoords, rendRecord, vboID, offsetBytes);
- if (gl.isGL2ES1()) {
- gl.getGL2ES1().glColorPointer(colorCoords.getValuesPerTuple(), GL.GL_FLOAT, 0, offsetBytes);
- }
- if (gl.isGL2GL3()) {
- gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_COLOR_ARRAY);
- }
- offsetBytes += colorCoords.getBufferLimit() * 4;
- } else {
- if (gl.isGL2GL3()) {
- gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_COLOR_ARRAY);
- }
- }
-
- if (textureCoords != null) {
- final TextureState ts = (TextureState) context.getCurrentState(RenderState.StateType.Texture);
- int enabledTextures = rendRecord.getEnabledTextures();
- final boolean valid = rendRecord.isTexturesValid();
- boolean exists, wasOn;
- if (ts != null) {
- final int max = caps.isMultitextureSupported()
- ? Math.min(caps.getNumberOfFragmentTexCoordUnits(), TextureState.MAX_TEXTURES)
- : 1;
- for (int i = 0; i < max; i++) {
- wasOn = (enabledTextures & (2 << i)) != 0;
- exists = i < textureCoords.size() && textureCoords.get(i) != null
- && i <= ts.getMaxTextureIndexUsed();
-
- if (!exists) {
- if (valid && !wasOn) {
- continue;
- } else {
- checkAndSetTextureArrayUnit(i, gl, rendRecord, caps);
-
- // disable bit in tracking int
- enabledTextures &= ~(2 << i);
-
- // disable state
- if (gl.isGL2GL3()) {
- gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_TEXTURE_COORD_ARRAY);
- }
-
- continue;
- }
-
- } else {
- checkAndSetTextureArrayUnit(i, gl, rendRecord, caps);
-
- // grab a vboID and make sure it exists and is up to date.
- final FloatBufferData textureBufferData = textureCoords.get(i);
- updateVBO(textureBufferData, rendRecord, vboID, offsetBytes);
-
- if (!valid || !wasOn) {
- // enable bit in tracking int
- enabledTextures |= (2 << i);
-
- // enable state
- if (gl.isGL2GL3()) {
- gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_TEXTURE_COORD_ARRAY);
- }
- }
-
- // send data
- if (gl.isGL2ES1()) {
- gl.getGL2ES1().glTexCoordPointer(textureBufferData.getValuesPerTuple(), GL.GL_FLOAT, 0,
- offsetBytes);
- }
- offsetBytes += textureBufferData.getBufferLimit() * 4;
- }
- }
- }
-
- rendRecord.setEnabledTextures(enabledTextures);
- rendRecord.setTexturesValid(true);
- }
-
- if (vertexCoords != null) {
- updateVBO(vertexCoords, rendRecord, vboID, offsetBytes);
- if (gl.isGL2ES1()) {
- gl.getGL2ES1().glVertexPointer(vertexCoords.getValuesPerTuple(), GL.GL_FLOAT, 0, offsetBytes);
- }
- if (gl.isGL2GL3()) {
- gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
- }
- } else {
- if (gl.isGL2GL3()) {
- gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
- }
- }
- }
-
- private void initializeInterleavedVBO(final RenderContext context, final FloatBufferData interleaved,
- final FloatBufferData vertexCoords, final FloatBufferData normalCoords, final FloatBufferData colorCoords,
- final List<FloatBufferData> textureCoords, final int bufferSize) {
-
- // keep around buffer size
- if (interleaved.getBufferCapacity() != 1) {
- final FloatBuffer buffer = BufferUtils.createFloatBufferOnHeap(1);
- interleaved.setBuffer(buffer);
- }
- interleaved.getBuffer().rewind();
- interleaved.getBuffer().put(bufferSize);
-
- final GL gl = GLContext.getCurrentGL();
-
- final RendererRecord rendRecord = context.getRendererRecord();
- final ContextCapabilities caps = context.getCapabilities();
-
- final int vboID = makeVBOId();
- interleaved.setVBOID(context.getGlContextRep(), vboID);
-
- rendRecord.invalidateVBO();
- JoglRendererUtil.setBoundVBO(rendRecord, vboID);
- gl.glBufferData(GL.GL_ARRAY_BUFFER, bufferSize, null, getGLVBOAccessMode(interleaved.getVboAccessMode()));
-
- int offset = 0;
- if (normalCoords != null) {
- normalCoords.getBuffer().rewind();
- gl.glBufferSubData(GL.GL_ARRAY_BUFFER, offset, normalCoords.getBufferLimit() * 4, normalCoords.getBuffer());
- offset += normalCoords.getBufferLimit() * 4;
- }
- if (colorCoords != null) {
- colorCoords.getBuffer().rewind();
- gl.glBufferSubData(GL.GL_ARRAY_BUFFER, offset, colorCoords.getBufferLimit() * 4, colorCoords.getBuffer());
- offset += colorCoords.getBufferLimit() * 4;
- }
- if (textureCoords != null) {
- final TextureState ts = (TextureState) context.getCurrentState(RenderState.StateType.Texture);
- if (ts != null) {
- for (int i = 0; i <= ts.getMaxTextureIndexUsed() && i < caps.getNumberOfFragmentTexCoordUnits(); i++) {
- if (i >= textureCoords.size()) {
- continue;
- }
-
- final FloatBufferData textureBufferData = textureCoords.get(i);
- if (textureBufferData != null) {
- final FloatBuffer textureBuffer = textureBufferData.getBuffer();
- if (textureBuffer != null) {
- textureBuffer.rewind();
- gl.glBufferSubData(GL.GL_ARRAY_BUFFER, offset, textureBufferData.getBufferLimit() * 4,
- textureBuffer);
- offset += textureBufferData.getBufferLimit() * 4;
- }
- }
- }
- }
- }
- if (vertexCoords != null) {
- vertexCoords.getBuffer().rewind();
- gl.glBufferSubData(GL.GL_ARRAY_BUFFER, offset, vertexCoords.getBufferLimit() * 4, vertexCoords.getBuffer());
- }
-
- interleaved.setNeedsRefresh(false);
- }
-
- @Override
public void drawElementsVBO(final IndexBufferData<?> indices, final int[] indexLengths,
final IndexMode[] indexModes, final int primcount) {
final GL gl = GLContext.getCurrentGL();