LWJGL
May 21, 2013, 01:36:56 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: LWJGL 2.9.0 released!
 
   Home   Help Search Login Register  



Pages: [1]
  Print  
Author Topic: Passing 2 dimensional arrays into FloatBuffer.  (Read 766 times)
sasmaster
Newbie
*
Posts: 13


« on: June 17, 2012, 06: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++ :
Code:
   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 .
Logged
sasmaster
Newbie
*
Posts: 13


« Reply #1 on: June 21, 2012, 00:56:08 »

Hey!!! No-one of LWJGL gurus can help here ?
Logged
Fool Running
Nerdus Imperius
*****
Posts: 742


« Reply #2 on: June 22, 2012, 06: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.
Logged

Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option Grin
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines
SMFAds for Free Forums
Valid XHTML 1.0! Valid CSS!