Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Davi

#1
"-cam.backBx, -cam.backBy, -cam.backBz",how to get them? :-[
#2
please post me that part (6 lines or so...), may be that can help me ;D
#3
Quote from: EgonOlsen on October 30, 2011, 07:51:47 PM
The projection matrix is implicitly created by the engine based on the current fov settings and the far and near clipping plane. There's no way to set it directly from the outside. The model view matrix in OpenGL is a combination of object space->world space and world space->camera space transformations. The matrix itself is set by the engine based on an object's transformation and the camera rotation and position. You can't take some random GL code and just extract the matrices to feed them into jPCT-AE. You have to understand what the code does and rebuild it's behaviour by using the means that the engine offers.
how can I understand what the code does,can you give me some open source code about that?
#4
   
Quote
   @Override
    protected void onDestroy() {
                TextureManager.getInstance().removeTexture(texturesName);
                model=null;
                fb.freeMemory();
                fb.dispose();
                fb=null;
                world.dispose();
                world=null;   
                  Loader.clearCache();               
               }
thank you very much, it seems can't release all texture memory from my system,can you tell me how to clear all memory completely,
use as following code:

TextureManager.getInstance().removeTexture(texturesName);
TextureManager.getInstance().flush();
TextureManager.getInstance().removeAndUnload(textureName,frameBuffer)

right?
#5
you 2 lines code mean the global variable Object3D model is not the same as local variable Object3D model.
I have done that in onDestory(),the code as following:

                @Override
protected void onDestroy() {
                model=null;
                fb=null;
                world=null;
                TextureManager.getInstance().removeTexture(texturesName);
                 Loader.clearCache();               
               }

above is right?
#6
I have two activities.one is first page,it has a start button,when I clike this button,it will load my two md2 models at the same time ,when they load completely,it will skip two my game activity,in my game activity , this time,two models work normally, when I click key Back,it will go back to my first page,but at this time,if I click the start button again,my app will crashed,and there will be some error messages in logcat:


11-14 17:14:08.106: E/AndroidRuntime(19642): java.lang.OutOfMemoryError
11-14 17:14:08.106: E/AndroidRuntime(19642): at com.threed.jpct.Mesh.<init>(Mesh.java:143)
11-14 17:14:08.106: E/AndroidRuntime(19642): at com.threed.jpct.Mesh.cloneMesh(Mesh.java:332)
11-14 17:14:08.106: E/AndroidRuntime(19642): at com.threed.jpct.Loader.loadMD2(Loader.java:1328)
11-14 17:14:08.106: E/AndroidRuntime(19642): at com.threed.jpct.Loader.loadMD2(Loader.java:131)
11-14 17:14:08.106: E/AndroidRuntime(19642): at org.mxr.app.ModelLoading.loading(ModelLoading.java:75)
11-14 17:14:08.106: E/AndroidRuntime(19642): at org.mxr.app.ModelLoading.run(ModelLoading.java:65)
11-14 17:14:08.106: E/AndroidRuntime(19642): at java.lang.Thread.run(Thread.java:1102)
11-14 17:14:08.576: E/ActivityManager(1327): fail to set top app changed!


this is out of memorry,I just want to know how to clear entire cache after load md2 models before go back to first page?


#7
Support / Re: load 5 md2 models at the same time
November 15, 2011, 04:29:20 AM
yeh,that is file size,oh my mistake,each model about 600kB,and each texture picture about 100kB ,I have use a thread to load them at the same time. but when I load about the third one, my app is crashed,the log error is out of memory.my code as following:

for(int i=0;i<5;i++){
modelList.add(Loader.loadMD2(this.getResources().getAssets().open(modelName[i], AssetManager.ACCESS_UNKNOWN), 3f));
TextureManager.getInstance().addTexture(texturesName[i], 
new Texture(BitmapFactory.decodeResource(this.getResources(), texturePictureId[i])));
}


I know there must be a good way to deal with this situation like my question.can you help me how to do that?   
#8
Support / load 5 md2 models at the same time
November 14, 2011, 08:56:33 AM
Hello,I have 5 md2 models,each model is about 2M,I want to load them at the same time,I don't know how to load it correctly, maybe there will be out of memorry? I have no idea,please give me a hint. :-\
#9
Support / load md2 model question
November 10, 2011, 07:20:23 AM
I have load md2 successully,but every time I use code finish my Activity,after that I restart my app,it often crashed. the log is as following:
11-09 13:57:53.769: E/dalvikvm(25707): Out of memory: Heap Size=24323KB, Allocated=24129KB, Bitmap Size=0KB, Limit=21884KB
11-09 13:57:53.769: E/dalvikvm(25707): Extra info: Footprint=24519KB, Allowed Footprint=24583KB, Trimmed=1060KB
11-09 13:57:53.779: W/dalvikvm(25707): threadid=13: thread exiting with uncaught exception (group=0x40025a70)
11-09 13:57:53.779: E/AndroidRuntime(25707): FATAL EXCEPTION: GLThread 16
11-09 13:57:53.779: E/AndroidRuntime(25707): java.lang.OutOfMemoryError
11-09 13:57:53.779: E/AndroidRuntime(25707): at com.threed.jpct.Mesh.<init>(Mesh.java:141)
11-09 13:57:53.779: E/AndroidRuntime(25707): at com.threed.jpct.Mesh.cloneMesh(Mesh.java:332)
11-09 13:57:53.779: E/AndroidRuntime(25707): at com.threed.jpct.Loader.loadMD2(Loader.java:1328)
11-09 13:57:53.779: E/AndroidRuntime(25707): at com.threed.jpct.Loader.loadMD2(Loader.java:131)
11-09 13:57:53.779: E/AndroidRuntime(25707): at org.opencv.mxrtoolkit.GLLayer.loadModel
   

the jpct-ae log is as following:

11-09 14:15:15.149: I/jPCT-AE(25759): Static references cleared...
11-09 14:15:15.529: I/jPCT-AE(25759): Loading Texture...
11-09 14:15:15.539: I/jPCT-AE(25759): Loading file from InputStream
11-09 14:15:15.549: I/jPCT-AE(25759): Expanding buffers...16384 bytes
11-09 14:15:15.549: I/jPCT-AE(25759): Expanding buffers...24576 bytes
11-09 14:15:15.549: I/jPCT-AE(25759): Expanding buffers...32768 bytes
11-09 14:15:15.549: I/jPCT-AE(25759): Expanding buffers...40960 bytes
11-09 14:15:15.549: I/jPCT-AE(25759): Expanding buffers...49152 bytes
11-09 14:15:15.549: I/jPCT-AE(25759): Expanding buffers...57344 bytes
11-09 14:15:15.549: I/jPCT-AE(25759): Expanding buffers...65536 bytes
11-09 14:15:15.549: I/jPCT-AE(25759): Expanding buffers...73728 bytes
11-09 14:15:15.549: I/jPCT-AE(25759): Expanding buffers...81920 bytes
11-09 14:15:15.559: I/jPCT-AE(25759): Expanding buffers...163840 bytes
11-09 14:15:15.639: I/jPCT-AE(25759): Expanding buffers...245760 bytes
11-09 14:15:15.639: I/jPCT-AE(25759): File from InputStream loaded...228764 bytes
11-09 14:15:15.719: I/jPCT-AE(25759): Magic number: 844121161
11-09 14:15:15.719: I/jPCT-AE(25759): Version: 8
11-09 14:15:15.719: I/jPCT-AE(25759): Skin width: 168
11-09 14:15:15.719: I/jPCT-AE(25759): Skin height: 195
11-09 14:15:15.719: I/jPCT-AE(25759): Frame size: 1064
11-09 14:15:15.719: I/jPCT-AE(25759): Number of skins: 0
11-09 14:15:15.719: I/jPCT-AE(25759): Number of Vertices: 256
11-09 14:15:15.719: I/jPCT-AE(25759): Number of Texture coordinates: 348
11-09 14:15:15.719: I/jPCT-AE(25759): Number of triangles: 512
11-09 14:15:15.719: I/jPCT-AE(25759): Number of GL-commands: 2622
11-09 14:15:15.719: I/jPCT-AE(25759): Number of Frames: 198
11-09 14:15:15.719: I/jPCT-AE(25759): Reading Texture coordinates...
11-09 14:15:15.719: I/jPCT-AE(25759): Done!
11-09 14:15:15.719: I/jPCT-AE(25759): Reading polygonal data...
11-09 14:15:15.719: I/jPCT-AE(25759): Done!
11-09 14:15:15.899: I/jPCT-AE(25759): Reading keyframes...
11-09 14:15:15.959: I/jPCT-AE(25759): Done!
11-09 14:15:15.959: I/jPCT-AE(25759): Coverting MD2-format into jPCT-format...
11-09 14:15:16.019: I/jPCT-AE(25759): Processing: stand...
11-09 14:15:16.299: I/jPCT-AE(25759): Processing: run...
11-09 14:15:16.429: I/jPCT-AE(25759): Processing: attack...
11-09 14:15:16.469: I/jPCT-AE(25759): Processing: pain...
11-09 14:15:16.629: I/jPCT-AE(25759): Processing: jump...
11-09 14:15:16.659: I/jPCT-AE(25759): Processing: flip...
11-09 14:15:16.819: I/jPCT-AE(25759): Processing: salute...
11-09 14:15:16.969: I/jPCT-AE(25759): Processing: taunt...
11-09 14:15:17.879: I/jPCT-AE(25759): Processing: wave...

I'm sure some memory is not released when I exist this activity, how to release it use jpct-ae ?
#10
Support / Re: how to set the FrameBuffer to alpha
November 02, 2011, 04:00:48 AM
oh,thank you ,I have figure it out. when I draw camera texture,I have disable some key code:
gl.glDisable(GL10.GL_TEXTURE_2D);
gl.glEnable(GL10.GL_DEPTH_TEST);
gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);

so,if use above codes before I draw other texure,it will never show texture on other models.
#11
Support / Re: how to set the FrameBuffer to alpha
November 02, 2011, 03:17:10 AM
I found that,if I draw camera Texture without using jpct-ae,and then draw md2 model texture using jpct-ae,it can't show the model texture. if I comment the code about drawing camera Texture, and then draw md2 model texture,it can show the texture.it's so strange!!!
maybe camera Texture effects the model texture.
question: jpct-ae's texture whether can be effected by any other thing or not? how to solve it? please
#12


onDrawFrame(GL10 gl) {

matrixTrans=new Matrix();
matrixTrans.translate(a,b,c)
model.setTranslationMatrix(matrixTrans);

//doAnim(); 
world.renderScene(fb);
world.draw(fb);
fb.display();
}
   
a,b,c is my dynamic value,it can control my model moved by my marker correctly before using jpct-ae. But with jpct, it seems can't be transformed correctly,at least not entirely correct. eg.when my marker is away from my device camera,it can be scaled correctly.but when I move my marker from up to down or from left to right,it can not moved to right place,but the  orientation is right.I don't know it is effected by wold or camra of jpct-ae. please?
#13
Thank you very much ;D
#14
Support / Re: how to set the FrameBuffer to alpha
October 31, 2011, 09:44:30 AM
the logcat is the issue of no texture:

I/jPCT-AE (11870): Loading Texture...
I/jPCT-AE (11870): Loading file from InputStream
I/jPCT-AE (11870): Expanding buffers...16384 bytes
I/jPCT-AE (11870): Expanding buffers...24576 bytes
I/jPCT-AE (11870): Expanding buffers...32768 bytes
I/jPCT-AE (11870): Expanding buffers...40960 bytes
I/jPCT-AE (11870): Expanding buffers...49152 bytes
I/jPCT-AE (11870): Expanding buffers...57344 bytes
I/jPCT-AE (11870): Expanding buffers...65536 bytes
I/jPCT-AE (11870): Expanding buffers...73728 bytes
I/jPCT-AE (11870): Expanding buffers...81920 bytes
I/jPCT-AE (11870): Expanding buffers...163840 bytes
I/jPCT-AE (11870): Expanding buffers...245760 bytes
I/jPCT-AE (11870): Expanding buffers...327680 bytes
I/jPCT-AE (11870): Expanding buffers...409600 bytes
I/jPCT-AE (11870): File from InputStream loaded...346308 bytes
I/jPCT-AE (11870): Magic number: 844121161
I/jPCT-AE (11870): Version: 8
I/jPCT-AE (11870): Skin width: 256
I/jPCT-AE (11870): Skin height: 256
I/jPCT-AE (11870): Frame size: 1612
I/jPCT-AE (11870): Number of skins: 5
I/jPCT-AE (11870): Number of Vertices: 393
I/jPCT-AE (11870): Number of Texture coordinates: 561
I/jPCT-AE (11870): Number of triangles: 764
I/jPCT-AE (11870): Number of GL-commands: 3833
I/jPCT-AE (11870): Number of Frames: 198
I/jPCT-AE (11870): Reading Texture coordinates...
I/jPCT-AE (11870): Done!
I/jPCT-AE (11870): Reading polygonal data...
I/jPCT-AE (11870): Done!
I/jPCT-AE (11870): Reading keyframes...
I/jPCT-AE (11870): Done!
I/jPCT-AE (11870): Coverting MD2-format into jPCT-format...
I/jPCT-AE (11870): Processing: stand...
I/jPCT-AE (11870): Processing: run...
I/jPCT-AE (11870): Processing: attack...
I/jPCT-AE (11870): Processing: pain...
I/jPCT-AE (11870): Processing: jump...
I/jPCT-AE (11870): Processing: flipoff...
I/jPCT-AE (11870): Processing: salute...
I/jPCT-AE (11870): Processing: taunt...
I/jPCT-AE (11870): Processing: wave...
I/jPCT-AE (11870): Processing: point...
I/jPCT-AE (11870): Processing: crstand...
I/jPCT-AE (11870): Processing: crwalk...
I/jPCT-AE (11870): Processing: crattack..
I/jPCT-AE (11870): Processing: crpain...
I/jPCT-AE (11870): Processing: crdeath...
I/jPCT-AE (11870): Processing: deatha...
I/jPCT-AE (11870): Processing: deathb...
I/jPCT-AE (11870): Processing: deathc...
I/jPCT-AE (11870): Done!
I/jPCT-AE (11870): Normal vectors calculated in 88ms!
I/jPCT-AE (11870): OpenGL vendor:     Qualcomm
I/jPCT-AE (11870): OpenGL renderer:   Adreno 205
I/jPCT-AE (11870): OpenGL version:    OpenGL ES-CM 1.1
I/jPCT-AE (11870): OpenGL renderer initialized (using 2 texture stages)
I/jPCT-AE (11870): Using vm based buffer copies!
I/jPCT-AE (11870): Remapping 642 vertex indices!
I/jPCT-AE (11870): Creating vertex cache (15408 bytes)!
I/jPCT-AE (11870): Vertex indices will be mapped!
I/jPCT-AE (11870): Subobject of object 0/object2 compiled to indexed fixed point data using 2292 vertices in 70ms!
I/jPCT-AE (11870): Object 0/object2 compiled to 1 subobjects in 88ms!
I/jPCT-AE (11870): Object 'object2' uses one texture set!
I/jPCT-AE (11870): VBO created for object 'object2'

what's wrong with that?
#15
I have a projection matrix,I don't know whether it needs to set with jpct-ae? then how to do?