Project

General

Profile

« Previous | Next » 

Revision 79921db2

Added by Leszek Koltunski about 7 years ago

Some progress with Transform Feedback. Still many bugs all over.

View differences:

src/main/java/org/distorted/library/MeshObject.java
45 45
   int[] mTexVBO = new int[1];
46 46

  
47 47
   int[] mPosTBO = new int[1]; // Transform Feedback
48
   int[] mNorTBO = new int[1]; // Transform Feedback
48 49

  
49 50
   final float zFactor; // strange workaround for the fact that we need to somehow store the 'depth'
50 51
                        // of the Mesh. Used in DistortedEffects. See DistortedTexture.getDepth().
......
83 84
       {
84 85
       GLES30.glGenBuffers(1, mTexVBO, 0);
85 86
       GLES30.glBindBuffer(GLES30.GL_ARRAY_BUFFER, mTexVBO[0]);
86
       GLES30.glBufferData(GLES30.GL_ARRAY_BUFFER, dataLength*    TEX_DATA_SIZE*BYTES_PER_FLOAT, mMeshTexture  , GLES30.GL_STATIC_DRAW);
87
       GLES30.glBufferData(GLES30.GL_ARRAY_BUFFER, dataLength*     TEX_DATA_SIZE*BYTES_PER_FLOAT, mMeshTexture  , GLES30.GL_STATIC_DRAW);
87 88
       }
88 89

  
89 90
     if( mPosTBO[0]<0 )
......
92 93
       GLES30.glBufferData(GLES30.GL_TRANSFORM_FEEDBACK_BUFFER, dataLength*POSITION_DATA_SIZE*BYTES_PER_FLOAT, null, GLES30.GL_STATIC_READ);
93 94
       GLES30.glBindBuffer(GLES30.GL_TRANSFORM_FEEDBACK_BUFFER, 0);
94 95
       }
96
     if( mNorTBO[0]<0 )
97
       {
98
       GLES30.glBindBuffer(GLES30.GL_TRANSFORM_FEEDBACK_BUFFER, mNorTBO[0]);
99
       GLES30.glBufferData(GLES30.GL_TRANSFORM_FEEDBACK_BUFFER, dataLength*  NORMAL_DATA_SIZE*BYTES_PER_FLOAT, null, GLES30.GL_STATIC_READ);
100
       GLES30.glBindBuffer(GLES30.GL_TRANSFORM_FEEDBACK_BUFFER, 0);
101
       }
95 102

  
96 103
     GLES30.glBindBuffer(GLES30.GL_ARRAY_BUFFER, 0);
97 104
     }
......
121 128
       GLES30.glDeleteBuffers(1, mPosTBO, 0);
122 129
       mPosTBO[0] = -1;
123 130
       }
131
     if( mNorTBO[0]>=0 )
132
       {
133
       GLES30.glDeleteBuffers(1, mNorTBO, 0);
134
       mNorTBO[0] = -1;
135
       }
124 136
     }
125 137

  
126 138
///////////////////////////////////////////////////////////////////////////////////////////////////
......
131 143
     mNorVBO[0] = -1;
132 144
     mTexVBO[0] = -1;
133 145
     mPosTBO[0] = -1;
146
     mNorTBO[0] = -1;
134 147
     }
135 148

  
136 149
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff