Passing 2 dimensional arrays into FloatBuffer.

Started by sasmaster, June 17, 2012, 13:01:01

Previous topic - Next topic

sasmaster

Hi ,I am porting MSAA feature from C++ OpenGL 3.3 .But I see that FloatBuffer can't accept 2 dimensional arrays?
Here is my source code in C++ :
   glGenBuffers(1, &sampleWeightBuf);
    glBindBuffer(GL_TEXTURE_BUFFER_ARB, sampleWeightBuf);
    glBufferData(GL_TEXTURE_BUFFER_ARB, sizeof(float)*8, sampleWeights, GL_DYNAMIC_DRAW);
    glBindBuffer(GL_TEXTURE_BUFFER_ARB, 0);

where sampleWeights is float[][] array. It must be 2 dimensional as it holds 16 sample arrays for 16 sample points .(MSAA x16 level) How do I do it in Java?  May be I should pass into FloatBuffer only the first element ? or put it all into a regular float[] ? I mean how do I fill such a data into texture buffer when FloatBuffer in java doesn't accept 2 dimensional arrays ?
Thanks .

sasmaster

Hey!!! No-one of LWJGL gurus can help here ?

Fool Running

I don't really know for sure, but you probably have to make the 2-dimensional array 1-dimension (i.e. put the first row first, then the second row, etc.). So you would get a 1-dimensional array of 256 elements.
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D