我有一个声明为的float数组camObjCoord.
public static float camObjCoord [] = new float [8000];
然后,我将其索引填充到一个类似以下内容的类中.
public voID addcube(float highx,float lowx,float highz,float lowz){ //Constructing new cube... System.out.println("f = " + f); Global.cubes++; float y = 1.5f; System.out.println("highx = " + highx + "lowx = " + lowx + "highz = " + highz + "lowz = " + lowz); //FRONT camObjCoord[i] = lowx; i++; camObjCoord[i] = -y; i++; camObjCoord[i] = highz; i++; camObjCoord[i] = highx; i++; camObjCoord[i] = -y; i++; camObjCoord[i] = highz; i++; camObjCoord[i] = lowx; i++; camObjCoord[i] = y; i++; camObjCoord[i] = highz; i++; camObjCoord[i] = highx; i++; camObjCoord[i] = y; i++; camObjCoord[i] = highz; //BACK i++; camObjCoord[i] = lowx; i++; camObjCoord[i] = -y; i++; camObjCoord[i] = lowz; i++; camObjCoord[i] = lowx; i++; camObjCoord[i] = y; i++; camObjCoord[i] = lowz; i++; camObjCoord[i] = highx; i++; camObjCoord[i] = -y; i++; camObjCoord[i] = lowz; i++; camObjCoord[i] = highx; i++; camObjCoord[i] = y; i++; camObjCoord[i] = lowz; i++; //left camObjCoord[i] = lowx; i++; camObjCoord[i] = -y; i++; camObjCoord[i] = highz; i++; camObjCoord[i] = lowx; i++; camObjCoord[i] = y; i++; camObjCoord[i] = highz; i++; camObjCoord[i] = lowx; i++; camObjCoord[i] = -y; i++; camObjCoord[i] = lowz; i++; camObjCoord[i] = lowx; i++; camObjCoord[i] = y; i++; camObjCoord[i] = lowz; i++; //RIGHT camObjCoord[i] = highx; i++; camObjCoord[i] = -y; i++; camObjCoord[i] = lowz; i++; camObjCoord[i] = highx; i++; camObjCoord[i] = y; i++; camObjCoord[i] = lowz; i++; camObjCoord[i] = highx; i++; camObjCoord[i] = -y; i++; camObjCoord[i] = highz; i++; camObjCoord[i] = highx; i++; camObjCoord[i] = y; i++; camObjCoord[i] = highz; i++; //top camObjCoord[i] = lowx; i++; camObjCoord[i] = y; i++; camObjCoord[i] = highz; i++; camObjCoord[i] = highx; i++; camObjCoord[i] = y; i++; camObjCoord[i] = highz; i++; camObjCoord[i] = lowx; i++; camObjCoord[i] = y; i++; camObjCoord[i] = highz; i++; camObjCoord[i] = highx; i++; camObjCoord[i] = y; i++; camObjCoord[i] = lowz; i++; //BottOM camObjCoord[i] = lowx; i++; camObjCoord[i] = -y; i++; camObjCoord[i] = highz; i++; camObjCoord[i] = lowx; i++; camObjCoord[i] = -y; i++; camObjCoord[i] = lowz; i++; camObjCoord[i] = highx; i++; camObjCoord[i] = -y; i++; camObjCoord[i] = highz; i++; camObjCoord[i] = highx; i++; camObjCoord[i] = -y; i++; camObjCoord[i] = lowz; i++; int p = 0; System.out.println("FulL ARRAY"); while(p < 72){ System.out.println(camObjCoord[p]); p++; }}
然后我打电话给makevIEw()
public voID makevIEw() { Intent myIntent = new Intent(this,GLCamTest.class); Bundle b = new Bundle(); b.putfloatArray("tweets",camObjCoord); myIntent.putExtras(b); this.startActivity(myIntent);}
然后在新课程中…
public voID onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle b = this.getIntent().getExtras(); float original[] = b.getfloatArray("tweets"); camObjCoord = original; counter++;}
然后,我还有另一个类GLLayer,它的外观如下所示.http://pastebin.org/394884在该类中,我正在从float数组中绘制多维数据集,我已经检查过了,并且确实存在多维数据集的值,当我m在其中编码数组可以工作,但是当我动态构建数组然后将其传递时,立方体无法绘制.我这样叫课.
glVIEw=new GLLayer(this); mPrevIEw = new CamLayer(this,glVIEw);
有人知道为什么吗?我该如何解决我的问题?只是要补充一点,我在动态绘制时将完全相同的值赋予完全相同的索引
final static float camObjCoord[] = new float[] { // FRONT -2.0f,-1.5f,2.0f,-2.0f,1.5f,// BACK -2.0f,// left -2.0f,// RIGHT 2.0f,// top -2.0f,// BottOM -2.0f,};
然后它将渲染此多维数据集.似乎不喜欢我先创建数组,然后动态添加索引.为什么?我该如何解决?为了获得奖励,我还将接受一个适用于AndroID的适当解决方法.
谢谢.
edit1:我尝试过各种事情,如果不是像这样声明数组,那不是数组的传递导致问题.
edit2:我也尝试过将数组放入GLLayer(渲染多维数据集的类)时进行打印,一切都与您期望的一样.我不知道为什么这些立方体不会出现:(
edit3:我已经添加了如何构造float数组.
edit4:我也尝试将数组的大小设置为等于我输入的值的数量.不起作用
最佳答案我会稍微减少这个问题.如果您要使数组足够大以仅容纳一个多维数据集,并以相同的方式填充它(但仅填充一次),那么它将起作用吗?如果您将它放大到足以容纳两个多维数据集,并为其提供两个多维数据集的数据该怎么办? 总结以上是内存溢出为你收集整理的java-动态绘制多维数据集时出现问题 全部内容,希望文章能够帮你解决java-动态绘制多维数据集时出现问题 所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)