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 - guillaume

#1
Support / Re: texture mismatch
October 08, 2013, 03:01:18 AM
Quote from: EgonOlsen on September 30, 2013, 12:09:26 PM
Yes, most likely. I don't know exactly how you are doing things, but what you can't do is to remove a texture, add another one with the same name and expect the objects to reflect this change. If an object uses a texture and that texture should be changed so that all objects using it will be using the new one, it's better to use TextureManager.replaceTexture for that. Remove (as well as unload) is suitable only for textures that aren't in use anymore, i.e. there are no active object that use them.
just with replaceTexture, the memory consumed gets more and more, and finally we get OOM.
is it OK for us to add unloadTexture after replaceTexture ?
ex.

      Texture oldTexture = ...
      TextureManager.replaceTexture(name, newTexture);
      TextureManager.unloadTexutre(fb,oldTexture);
#2
Support / Re: texture mismatch
September 30, 2013, 11:12:01 AM
Quote from: EgonOlsen on September 30, 2013, 08:44:03 AM
Textures don't get lost by itself. This can happen only if you remove/unload them. Are you doing this to the textures in question?
yes. we need to update  the textures' content, so we remove/unload/add them continuous. is this cause the problem ?
#3
Support / Re: texture mismatch
September 30, 2013, 04:45:13 AM
after try Config.unloadImmediately=true, it seems that texture misatch disappear.
but occasionally, we encounter texture lost. the position texture should appear
shows blank. any idea ?
#4
Support / Re: texture mismatch
August 29, 2013, 05:10:57 AM
Quote from: kiffa on August 28, 2013, 02:47:02 PM
I ran into the same problem before, and I suggest don't do like this:

TextureManager tm = TextureManager.getInstance();
    tm.addTexture("A", texture_1);
    obj.setTexture("A"); //set textureId to id_1
   
    //do other things, like adding other textures, etc...

    obj.setTexture("A");
    tm.removeAndUnload(frameBuffer, "A");
    tm.addTexture("A", texture_2); //add a new texture with the same name, and it has the id of id_2
   
    //will set to the same textureId id_1, and this may be incorrect; The correct one is id_2
    //maybe TextureManager.getTextureId(name) did some caching algorithms.
    obj.setTexture("A");
   
    //And then you will see the mismatched texture, because of the incorrect textureId.


But do like this:

    TextureManager tm = TextureManager.getInstance();
    tm.addTexture("A", texture_1);
    obj.setTexture("A"); //set textureId to id_1
   
    //do other things, like adding other textures, etc...
   
    tm.replaceTexture("A", texture_2);


yes. but when we use replaceTexture we encounter OOM exception finally , do you have meet this problem ?
#5
Support / Re: texture mismatch
August 28, 2013, 12:57:36 PM
yes, I do all unloads and replacements in onDrawFrame().
I will try make Config.unloadImmediately=true.  thanks.
#6
Support / Re: texture mismatch
August 28, 2013, 12:15:57 PM
"What do you mean with that? That your app replaces and unloads textures at runtime?"
yes. I do this at runtime. because I want to do marquee effect,  generate texture at runtime.
#7
Support / texture mismatch
August 28, 2013, 08:30:27 AM
hi, I write a jpct program, where has many object3D. some times a random bug happened.
one object3D's texture becomes another object3D's texture.
when the program run, it may replace and unload texture , do you have any idea ?
#8
Support / render movie to 3D object
May 16, 2013, 01:20:54 PM
hi, is this possible ? render movie to a 3D object .
#9
Support / Re: jPCT and real 3D
October 20, 2012, 07:07:19 AM
thanks. this really helps. 8)
#10
Support / Re: jPCT and real 3D
October 11, 2012, 01:14:16 PM
Quote from: EgonOlsen on October 11, 2012, 07:23:53 AM
I'm not aware of any problem with blitting. I'll try to create a simple test case today and post the results and the code.
thanks, Egon. I appreciate your help very much.
#11
Support / Re: jPCT and real 3D
October 11, 2012, 05:31:41 AM
thanks, egon.
with FrameBuffer.blit 's argument  destWidth set to mFb.getWidth()/2 , I got the device-2012-10-11-111842-half.png
with destWidth set to  mFb.getWidth(), I got  the device-2012-10-11-111934-full.png.
my goal is to show the full content in left side of the screen.

the half width image dose not show the full content of the full width image, but lost some.
does this mean that the FrameBuffer.blit is broken in android ?


mFb.blit(mLeftTexture,
0, 0, 0, mFb.getHeight(),
mLeftTexture.getWidth(), mLeftTexture.getHeight(),
mFb.getWidth(), -mFb.getHeight(), -1, false, null);


[attachment deleted by admin]
#12
Support / Re: jPCT and real 3D
October 10, 2012, 08:23:53 AM
Quote from: EgonOlsen on October 10, 2012, 08:16:54 AM
Does real 3d require to use two GLSurfaceView instances? Or would it work with one that contains both parts of the image?
No it doesn't.
we just require that the image contains left,right eye's view side by side.
#13
Support / Re: jPCT and real 3D
October 10, 2012, 05:29:56 AM
Quote from: EgonOlsen on October 09, 2012, 06:27:39 PM
You are not supposed to use multiple FrameBuffer instances at a time. This makes jPCT-AE think that the context has changed each time you render into it, which is why it behaves the way it does. You should be able to rewrite the code to use one buffer instead. If you assign a render target, the actual buffer size will be overriden by the size of the texture.

currently I render left eye's and right eye's scene to screen side by side. to achieve this,
I use two GLSurfaceView on the screen with two FrameBuffer.
by using ONE  FrameBuffer, How can I render side by side scene on screen ?
and before render to the screen, I would like to down scale the rendered image to its 1/2 width.
#14
Support / Re: jPCT and real 3D
October 09, 2012, 05:07:55 AM
finally, I got my real 3D render.
the base idea is :
1.  create 1 offscreen framebuffer for each eye
2.  set the  framebuffer to render to a Texture
3.  render one eye's view to the texture
4.  blit the texture to screen with down scale to  1/2  original size.

then problem comes:
1. after several frames, OOM exception thrown.
many logs like:
I/jPCT-AE (  574): OpenGL context has changed...trying to recover!
I/jPCT-AE (  574): OpenGL context has changed...trying to recover!
I/jPCT-AE (  574): OpenGL context has changed...trying to recover!
I/jPCT-AE (  574): Additional visibility list (380) created with size: 512
I/jPCT-AE (  574): OpenGL context has changed...trying to recover!
I/jPCT-AE (  574): OpenGL context has changed...trying to recover!
I/jPCT-AE (  574): OpenGL context has changed...trying to recover!
I/jPCT-AE (  574): Additional visibility list (390) created with size: 512

2. the blit down-scaled image is upside-down.

dear Egon, can you give some advices ? thanks.


import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;

import com.threed.jpct.Camera;
import com.threed.jpct.FrameBuffer;
import com.threed.jpct.Logger;
import com.threed.jpct.RGBColor;
import com.threed.jpct.Texture;
import com.tpv.ui.trid.AndroidFrameBlitter;
import com.tpv.ui.trid.TriDScene;
import com.tpv.ui.trid.real3d.Real3DRenderer.Position;

import android.opengl.GLSurfaceView.Renderer;
import android.util.Log;

public class Real3DRenderer implements Renderer {


private TriDScene mScene = null;
private FrameBuffer mFb = null;
private FrameBuffer mBackFb = null;
private Texture mBackTexture = null;
public enum Position {
LEFT,
RIGHT,
};
private Position mPos = Position.LEFT;
private float mSpeed = 0.0f;
private final float SPEED_OFFSET = 0.01f;

public void incAngle() {
// TODO Auto-generated method stub
mSpeed += SPEED_OFFSET;
if(mPos == Position.LEFT)
Log.d("3DUI","left camera speed"+mSpeed);
else
Log.d("3DUI","right camera speed"+mSpeed);
}
public void decAngle() {
// TODO Auto-generated method stub
mSpeed -= SPEED_OFFSET;
if(mSpeed < 0)
mSpeed = 0.0f;
if(mPos == Position.LEFT)
Log.d("3DUI","left camera speed "+mSpeed);
else
Log.d("3DUI","right camera speed "+mSpeed);

}

public Real3DRenderer(TriDScene scene, Position pos){
mScene = scene;
mPos = pos;
}
private RGBColor black = new RGBColor(0, 0, 0, 0);
@Override
public void onDrawFrame(GL10 gl) {
// TODO Auto-generated method stub

mBackFb.clear(black);
if(mPos == Position.LEFT)
mScene.renderFrame(mBackFb, -mSpeed);
else
mScene.renderFrame(mBackFb, mSpeed);
mBackFb.display();

// blit to screen
mFb.clear(black);
mFb.blit(mBackTexture, 0, 0, 0, 0,
mBackTexture.getWidth(), mBackTexture.getHeight(),
mBackTexture.getWidth()/2, mBackTexture.getHeight(),
-1,false, null);
mFb.display();


}
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
// TODO Auto-generated method stub
if (mFb != null) {
mFb.dispose();
}
mFb = new FrameBuffer(gl, width, height);
Logger.log("==== Launcher launch: " +width+"X" +height+" OpenGL Major Version: "+mFb.getOpenGLMajorVersion());

if(mBackFb != null){
mBackFb.dispose();
}
mBackFb = new FrameBuffer(gl, width*2, height);
mBackTexture = new Texture(width*2, height);
mBackFb.setRenderTarget(mBackTexture);
}

@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
// TODO Auto-generated method stub

}

}
#15
Support / Re: jPCT and real 3D
September 26, 2012, 10:54:45 AM
Quote from: EgonOlsen on September 21, 2012, 05:05:12 PM
You can render the scene multiple times with different cameras...if that does any good.
actually, after setup the world, I want to clone the world's camera
to two new cameras,  but there is no clone method for camera ,
how should I do it ?thanks