Log in or register to post comments

Error in eclipse when copying arrays from banana.h to Banana.java file

January 6, 2014 - 10:27pm #11

I am trying to replace Teapot with my own 3D model(Banana) . While building my own Banana.java on the lines of Teapot.java, I copied all the arrays from banana.h to Banana.java. I recieved an error -"Too many constants, the constant pool for Banana would exceed 65536 enteries" . Any idea how to get rid of this error?

Error in eclipse when copying arrays from banana.h to Banana.jav

January 7, 2014 - 12:21am #10

Hi, you cannot copy C++ code from a .h file to a Java file, unless you adjust the code to turn it into a Java equivalent. 

 

 

 

Error in eclipse when copying arrays from banana.h to Banana.jav

January 7, 2014 - 3:34am #9

By the statement " While building my own Banana.java on the lines of Teapot.java, I copied all the arrays from banana.h to Banana.java." - I meant copying values of all the 3 arrays vertices, normals and textcords from banana.h file to Banana.java file (which implies adjusting my c++ code(banana.h) to turn it to Java Equivalent(Banana.java) . I have taken reference of the Sample Teapot.java to freshly code my Banana.java  . Its just the values of the array for which I am refering the banana.h file .  My query is - when I copied the array values to my new Banana.java file , it showed a compile time error -"Too many constants, the constant pool for Banana would exceed 65536 enteries" 

Error in eclipse when copying arrays from banana.h to Banana.jav

January 7, 2014 - 3:41am #8

Ok, thanks for the clarification:

actually this is a  Java specific error, as your arrays definition contain too many values (i.e. in your case, too many floating point constants, which are the coordinates of your arrays).  In Java you can have at most 65K entries, and the Banana arrays are probably exceeding that.

You would neew to create the Java vertex arrays differently (e.g. reading the Banana.h as a text file, and extract the coordinates programmatically, and then build your arrays programmatically).

 

 

Error in eclipse when copying arrays from banana.h to Banana.jav

January 7, 2014 - 9:33pm #7

Yes. Reading cordinates and populating the array from a text file looks like a good option. Thanks a lot for the suggestion.

Error in eclipse when copying arrays from banana.h to Banana.jav

January 7, 2014 - 11:48pm #6

you're welcome.

Error in eclipse when copying arrays from banana.h to Banana.jav

January 9, 2014 - 9:40am #5

Hi,

 

I am also generating .h file for my 3D object and then trying to copy the arrays into the java file. it compiles well and run too but then the app hangs up instead of loading the object. Can anyone tell me what is the problem with that ?

Thanks.

Error in eclipse when copying arrays from banana.h to Banana.jav

May 23, 2014 - 6:38am #4

but how to call the array file from the a java class . I have added the text file in the assest folder. Is there any mean to retrieve it from the folder and using it

Error in eclipse when copying arrays from banana.h to Banana.jav

May 23, 2014 - 7:07am #3

Hi I need some help

Error in eclipse when copying arrays from banana.h to Banana.jav

July 2, 2014 - 2:19am #2

I read the solution below:

"You would neew to create the Java vertex arrays differently (e.g. reading the Banana.h as a text file, and extract the coordinates programmatically, and then build your arrays programmatically)."

how to extract the coordinates programmatically??

Error in eclipse when copying arrays from banana.h to Banana.jav

July 2, 2014 - 2:46am #1

Just implement a simple text parser in Java to read the comma-separated coordinates one by one, as they appear in the .h file.

 

Log in or register to post comments