LWJGL Forum

Programming => OpenGL => Topic started by: sasmaster on June 17, 2012, 13:01:01

Title: Passing 2 dimensional arrays into FloatBuffer.
Post by: sasmaster on June 17, 2012, 13:01:01
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 .
Title: Re: Passing 2 dimensional arrays into FloatBuffer.
Post by: sasmaster on June 21, 2012, 07:56:08
Hey!!! No-one of LWJGL gurus can help here ?
Title: Re: Passing 2 dimensional arrays into FloatBuffer.
Post by: Fool Running on June 22, 2012, 13:18:55
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.