Questions tagged [floatbuffer]

31 questions
7
votes
1 answer

how to change the content of a FloatBuffer, keeping performance?

i've tried using floatbuffer.put(float[]); but as i am handling more than 200 squares, all with diferent texture coordinates that are updated each frame, my fps drop drastically, and the game becomes too far to be fluid. y thought the method…
Jose
  • 129
  • 1
  • 9
5
votes
0 answers

Improve FloatBuffers' Performance with Native C/C++

I'm writing an OpenGL ES 2.0 Engine and using FloatBuffers, but I've heard FloatBuffers are slow on Android Froyo and moderatly quicker on Gingerbread. So what I want to know is, whether it's possible to create and edit buffers with native…
Martin Erhardt
  • 581
  • 11
  • 23
4
votes
4 answers

Determine Number of Elements in a FloatBuffer

FloatBuffer has the method capacity() which tells us the maximum capacity of the FloatBuffer. However, it does not tell us how many elements are in that buffer. So how can I determine the number of elements in a FloatBuffer? I am trying to determine…
user195488
3
votes
1 answer

Why can we directly allocate bytes in ByteBuffer but not floating Point in FloatBuffer

In java using openGL (ES) we can directly allocate ByteBuffer like ByteBuffer bf ; bf.allocateDirect(); But we can not do that in case of FloatBuffer it is not aviliable , why is that ? I was wondering if it is because of : Byte is accessible in…
erluxman
  • 18,155
  • 20
  • 92
  • 126
3
votes
1 answer

why do we allocate blocks in bytes rather than floats in OpenGL (ES) android , though we work with float most of the times

this is how i am made an array of triangle float[] tableVerticesWithTriangle = { // triangle 1 0f, 0f, 9f, 14f, 0f, 14f, // triangle 2 0f, 0f, 9f, 0f, 9f, 14f …
erluxman
  • 18,155
  • 20
  • 92
  • 126
2
votes
2 answers

convert from floatbuffer to byte[]

I'm trying to find a way to use jack-audio in java. I've managed to create wrapper based on jnajack to get audio from jacks' port to java app (the original jnajack is not working with jack 1.9.8), but I can't find a way to manipulate data. I'm…
K-O
  • 79
  • 2
  • 3
2
votes
1 answer

Fastest way to draw dynamic GL_TRIANGLE_STRIP

After some effort, I managed to draw dynamic aircraft trail using OpenGL. You may see a part of my code below: private void getTrailVertices(){ verticeBuffer = Buffers.newDirectFloatBuffer(6 * positionList.size()); for (int i = 0; i <…
2
votes
1 answer

How to load .glb (gltf) binary data model to AndroidStudio (OpenGLES20)

I try loading a model from a .glb file (Blender) doing the following: private FloatBuffer bufferXYZ; ByteBuffer glb_bb; ... byte[] bytes = new byte[vertexXYZ_BufferLen]; glb_bb.get(bytes, 0, bytes.length); …
2
votes
1 answer

I am unable to print this array.The application stops working post this line

I have to print this floatbuffer as array and there is a function for that in the documentation but the function is not working. I cant understand what am I doing wrong? I have tried using the floatBuffer.toString() but it does print the array that…
PARUL JINDAL
  • 49
  • 1
  • 6
2
votes
2 answers

Java OpenGL(JOGL) Object Arrays and FloatBuffers

I’m trying to find a may to minimize memory allocation and garbage collection in a Java OpenGL (JOGL) application. I am porting some C/C++/C# OpenGL project to Java as a learning exercise. One thing I am running into is the lack of pointers in…
2
votes
3 answers

How to get the Floatbuffer stored float[]?

Having - FloatBuffer floatBuffer = FloatBuffer.allocate(SIZE) how could I get its float[SIZE] ?
URL87
  • 10,667
  • 35
  • 107
  • 174
2
votes
2 answers

Android OpenGL dynamically size FloatBuffer?

I'm trying to build an OpenGL ES 2.0 rendering system on Android. I have one FloatBuffer, in which I put all vertex data. Currently, I just allocate it with a huge number of bytes and ignore draw calls if they would overfill the buffer at that…
chimitos
  • 79
  • 9
2
votes
1 answer

FloatBuffer OverflowException java

I have this code here: static ByteBuffer bytes = ByteBuffer.allocateDirect(16).order(ByteOrder.nativeOrder()); static FloatBuffer matAmbientB = bytes.asFloatBuffer(); static FloatBuffer matAmbientC = bytes.asFloatBuffer(); static FloatBuffer…
Coupon22
  • 395
  • 8
  • 24
1
vote
1 answer

Converting byte[] to float[]

I'm trying to convert a float[] to a byte[] in Android. I've looked at other questions and answers on stackoverflow but none of them helped so I decided to implement my own solution. The way I have tried is: byte[] data = some data; ByteBuffer…
John Bale
  • 433
  • 7
  • 16
1
vote
2 answers

Creation of FloatBuffer Array with for ¿overwrites values?

I'm creating an array of FloatBuffers with a for loop like this: FloatBuffer[] buffer = new FloatBuffer[sizebuffer]; float[] farray = new float[sizeArray]; for(int i=0;i
1
2 3