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

#1
Support / Re: creating FrameBuffer
September 22, 2012, 06:20:36 PM
then there is the problem. the onSurfaceXXX runs after the renderer.createBuffer() call. So how should i create the context before the rendering starts? Now i am doing it : setContentView(mGLView), and the frameBuffer is created in onSurfaceChanged() ,but the frameBuffer creation takes a bit too much time, so how to create this FrameBuffer, before the setContentView() is called?
#2
Support / Re: creating FrameBuffer
September 22, 2012, 05:43:59 PM
2.0

here is the createBuffer() method in MyRenderer class:

public void createBuffer(){
Log.e("Creating buffer 5" , " ");
fb = new FrameBuffer(320, 480); // these values are just for now
Log.e("Buffer created " , " ");
}


maybe this can help :
Quote09-22 15:49:50.150: I/jPCT-AE(614): [ 1348328990157 ] - ERROR: Failed to load and compile vertex shaders!
09-22 15:49:50.159: I/jPCT-AE(614): [ 1348328990161 ] - WARNING: Unable to load shader!
#3
Support / creating FrameBuffer
September 22, 2012, 10:39:26 AM
Hi,

Sorry I am asking again for help ;D , but I am wondering if it is possible to create FrameBuffer not in the methods onSurfaceCreate, onSurfaceChanged, onSurfaceDestroyed. Now i am creating the framebuffer in the onSurfaceChanged, and it takes about 2 seconds to create and it causes lags when starting the scene, that is why i would like to create it before the actual rendering begins(so before that when the user starts the level). I tried to run it on the GL thread this way :

mGLView.queueEvent(new Runnable() {
public void run() {
renderer.createBuffer();
}
});


but i just get an error:
Quote09-22 08:34:17.470: E/AndroidRuntime(610): java.lang.RuntimeException: [ 1348302857466 ] - ERROR: java.lang.RuntimeException: [ 1348302857454 ] - ERROR: java.lang.RuntimeException: [ 1348302857418 ] - ERROR: java.lang.RuntimeException: [ 1348302857409 ] - ERROR: Failed to load and compile vertex shaders!




#4
Support / Re: AA not working
September 21, 2012, 07:14:50 AM
sorry I am answering so late.

The problem is resolved, i created new project, upgraded to the newest jpct (1.25) and it is working again  :D

Thanks both of you  ;)
#5
Support / Re: AA not working
September 13, 2012, 03:48:26 PM
I know (i don't have my own smartphone), but it was working on emulator before and also on real device(my friend's), but now it isn't.

EDIT:
i tried to use the second AAConfigChooser constructor:
QuoteAAConfigChooser(GLSurfaceView view, boolean withAlpha)
mGLView.setEGLConfigChooser(new AAConfigChooser(mGLView,true));
and now in log it says:
Quote09-13 15:35:35.454: I/jPCT-AE(1049): Unable to find a matching config...using default!

maybe this can help you  ???
#6
Support / Re: AA not working
September 13, 2012, 11:33:02 AM
Yes i have.
that is the whole code i am doing with the mGLView:
mGLView = new GLSurfaceView(getApplication());
mGLView.setEGLContextClientVersion(2);
mGLView.setEGLConfigChooser(new AAConfigChooser(mGLView));
renderer = new MyRenderer();
mGLView.setRenderer(renderer);
mGLView.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
setContentView(mGLView);


and here is the FrameBuffer code initialization:
fb = new FrameBuffer(w, h);

Previously the AA was working on emalutor and also on the Samsung galaxy Ace device, but now it is not working on either of them. In emulator I am using android 4.1, which has support of OpenGL ES 2.0 on emulator, here is a log of it:
09-13 09:18:44.319: I/jPCT-AE(935): GL20 render pipeline initialized!
09-13 09:18:44.392: I/jPCT-AE(935): OpenGL vendor:     Google (ATI Technologies Inc.)
09-13 09:18:44.392: I/jPCT-AE(935): OpenGL renderer:   Android Emulator OpenGL ES Translator (ATI Radeon HD 4800 Series)
09-13 09:18:44.398: I/jPCT-AE(935): OpenGL version:    OpenGL ES 2.0 (3.3.11631 Compatibility Profile Context)
09-13 09:18:44.398: I/jPCT-AE(935): OpenGL renderer initialized (using 2 texture stages)


I tried to create new emulators, i restored the older version of my app where the AA might have been working, but nothing worked, i still keep getting "No AA enabled!"

I really don't know what else should i try  :-\
#7
Support / Re: AA not working
September 12, 2012, 03:19:59 PM
I tried it, and it still keep logging "No AA config found ... defaulting non-AA modes! No AA enabled! "
#8
Support / AA not working
September 12, 2012, 11:42:56 AM
Hi,

I am trying to enable AA in my game on Android. I am doing it this way:
mGLView.setEGLContextClientVersion(2);
mGLView.setEGLConfigChooser(new AAConfigChooser(mGLView) {
public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) {
int[] attributes = new int[] {EGL10.EGL_BLUE_SIZE,8,EGL10.EGL_RED_SIZE,8,EGL10.EGL_GREEN_SIZE,8, EGL10.EGL_DEPTH_SIZE, 16, EGL10.EGL_NONE };//EGL10.EGL_DEPTH_SIZE, 16,
EGLConfig[] configs = new EGLConfig[1];

int[] result = new int[1];
egl.eglChooseConfig(display, attributes, configs, 1, result);
return configs[0];
}
});


and in LogCat i found this:
Quote09-12 09:35:09.637: I/jPCT-AE(1267): No AA config found...defaulting to non-AA modes!
09-12 09:35:09.637: I/jPCT-AE(1267): No AA enabled!

As you can see i have enabled OpenGL 2.0, so i don't know what could be the problem.

Thanks for any help

#9
Support / PolygonID of an event TYPE_SOURCE
July 23, 2012, 08:46:57 AM
Hi,

My question is how can a I get the PolygonID of an event which type is TYPE_SOURCE . The object's(this object is the only one moving in my scene) collision mode which triggers this event is set to COLLISION_CHECK_SELF.  The other objects (which can't move) are set to COLLISION_CHECK_OTHERS. That is for me a problem because i need the polygonID of the moving object.

here is the collision setup in code :
                        Ball.setCollisionMode(Object3D.COLLISION_CHECK_SELF);
Wall.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
Cube.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);

ballPolygonManager = Ball.getPolygonManager();
wallPolygonManager = Wall.getPolygonManager();
cubePolygonManager = Cube.getPolygonManager();

Wall.addCollisionListener(new CollisionListener() {
public void collision(CollisionEvent ce) {
polygonID = ce.getPolygonIDs();
polygonManager = wallPolygonManager;
}

public boolean requiresPolygonIDs() {
return true;
}
});

Cube.addCollisionListener(new CollisionListener() {
public void collision(CollisionEvent ce) {
polygonID = ce.getPolygonIDs();
polygonManager = cubePolygonManager;
}

public boolean requiresPolygonIDs() {
return true;
}
});

Thanks for any help
#10
Support / Re: Ray-Polygon Collision problem
July 11, 2012, 09:09:24 AM
i solved it, the problem was in my calculations, i had one vector normalized, if i removed this normalization, it works now.

I have one more question. My physics almost works perfectly, when the ball hits the wall it reflects as it should, but when the ball is rolling on the wall (so it touches the wall, and there are many collision events) than the speed of the ball is bad, it is because on each hit of the wall the speed of the ball is reduced. How should i distinguish if the ball is just rolling on the wall(so that there are many collision events) or if the ball hits the wall just one time and reflects away? I have been thinking a lot about it, but i can't find any solution how to distinguish it.

Thanks for any help.

EDIT: Problem solved, problem was in reflection vector. Thanks for your help EgonOlsen  ;)
#11
Support / Re: Ray-Polygon Collision problem
July 04, 2012, 11:23:56 AM
I want the angle of the colliding objects, in order to calculate the reflection vector. I figured out how to do that. Get the polygonsID which was hit, and then calculate its normal through getTransformedNormal() method, and i also have the direction vector, then i found this in this forum:
public SimpleVector getReflectionVector(SimpleVector incoming, SimpleVector normal)
  {
    SimpleVector cross = incoming.calcCross(normal);
    cross = normal.calcCross(cross);
    cross.scalarMul(2);
    cross = incoming.calcSub(cross);
    return cross;
  }


it works, but sometimes a got wrong reflection vector (it is not quite wrong because it is mostly just rotated 1.54rad to left or right side). For example i have a normal vector : X = -1 ; Y = 0 then it works ok, but when i got normal vector X = -0.03407649 Y = 7.9632E-4 which should be almost same(except the lenght) vector as the first one, a i got suddenly wrong reflection vector. Why is that?
#12
Support / Re: Ray-Polygon Collision problem
July 01, 2012, 09:49:16 AM
Thanks for the answer, now it works great. But i realized that the most suitable detection method for my game is the Sphere-Polygon method. I have already implemented this method and it works, now i just need to know the angle between the colliding objects to calculate the my physics. I tried to use the SimpleVector which gave me the checkForCollisionSpherical() function and  to calculate the angle from this vector, it gives me some angle but it is pretty inaccurate sometimes. Is there another way to calculate the angle between tho colliding objects?

Thanks for the reply
#13
Support / Ray-Polygon Collision problem
June 27, 2012, 06:21:16 PM
Hi,

I have a problem with collision detection of two objects. I use Ray-Polygon method, problem is that when a cube is coliding with a longish cuboid, the collision event come just when i hit the long side of the cuboid, when i try to hit the cuboid from the top, the collision event come when the cube is a little bit in the cuboid, so it is not so precise. How can i make to receive collision events when the objects just touches each other? I tried to change the collideOffset, but with no result.

here is the setup for the collison mode:
Cube.setCollisionMode(Object3D.COLLISION_CHECK_SELF );
Cuboid.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);


and this is how i call the checkForCollision method :
cube.checkForCollision(movingDirection, 1)

I am also not sure what does the "step" argument in checkForCollision function mean. should that be the actual speed of the cube?

and there is the collisonListener :
Cube.addCollisionListener(new CollisionListener() {
public void collision(CollisionEvent ce) {
Log.e("COLLISION"," ");
}
public boolean requiresPolygonIDs() {
return false;
}
});


PS: Sorry for my English