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

#1
Support / Re: background video
February 20, 2014, 01:03:04 PM
Thanks guys for your replies.

I tried overrideTexelData with ByteBuffer first but could not get very far.

Then I tried SurfaceTexture and managed to get some progress. Now I have Audio playing but the video does not play.

so to test this, as a proof of concept, basically in the onSurfaceCreated of my GLSurfaceView.Renderer I create the media player and surface texture like this:


public void onSurfaceCreated(GL10 gl, EGLConfig config) {
int[] texture = new int[1];

        GLES20.glGenTextures(1,texture, 0);
        GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, texture[0]);
        GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
             GL10.GL_TEXTURE_MIN_FILTER,GL10.GL_LINEAR);       
        GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
             GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);
    GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
             GL10.GL_TEXTURE_WRAP_S, GL10.GL_CLAMP_TO_EDGE);
    GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
             GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE);

int mTextureID = texture[0];

mSurface = new SurfaceTexture(mTextureID);
mSurface.setOnFrameAvailableListener(new videoTexture());

try {
AssetFileDescriptor afd = getAssets().openFd("test7.mp4");
MediaPlayer player = new MediaPlayer();
    player.setDataSource(afd.getFileDescriptor(),afd.getStartOffset(),afd.getLength());
    player.setSurface(new Surface(mSurface));
    player.prepare();
    player.start();
    player.setLooping(true);

} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}


and then I have this class:

class videoTexture implements SurfaceTexture.OnFrameAvailableListener {
@Override
public void onFrameAvailable(SurfaceTexture surfaceTexture) {
updateSurface = true;
mGLView.requestRender();
}
}


and finally in my onDrawFrame method I have:

if (updateSurface) {
                mSurface.updateTexImage();
                updateSurface = false;
            }


I really appreciate your input  :)
#2
Support / background video
January 20, 2014, 07:49:33 AM
Hi,

I am trying to add a video to my game background. I tried FrameBuffer.blit method and changed the background texture on every frame but this is very slow and maxes out my memory pretty soon.

Is there any other way to display a video on the background?

Cheers
#3
Thanks Irony, I am at very early stages at the moment but what I have in mind is very similar to your game. I'll let you know if I have any questions. Thanks
#4
Thanks I really appreciate being showcased on the project page :)

I have already started working on a space dogfight game. Hopefully this will have a wider audience. 
#5
Hi All,

I finally published my first app. It is a learning aid for engineering students to understand advanced 3D stress analysis. I used JPCT for my sensor orientation. also almost all of the rotation calculations are handled by JPCT.

This App only works on devices with Android 4.0 or higher. Also it works best on HD devices (e.g. HTC One).

Please download:
https://play.google.com/store/apps/details?id=com.arash.mohrcircle




[attachment deleted by admin]
#6
Support / Re: setRotationPivot translates my object
September 19, 2013, 02:05:32 PM
Ahaa... got it.  ;D
Thanks man.
#7
Support / Re: setRotationPivot translates my object
September 19, 2013, 01:12:46 PM
Thanks for the quick response. but I really get my objects translated with the setRotationPivot method.

This code


xConeLeft = Primitives.getCone(90, 2);
xConeRight = Primitives.getCone(90, 2);
xConeRight.setAdditionalColor(new RGBColor(0, 0, 255));
xConeLeft.setAdditionalColor(new RGBColor(255, 0, 0));
xConeRight.rotateZ((float) -Math.PI/2);
xConeLeft.rotateZ((float) Math.PI/2);
xConeRight.strip();
xConeLeft.strip();
xConeRight.build();
xConeLeft.build();
world.addObject(xConeRight);
world.addObject(xConeLeft);

xConeRight.setRotationPivot(new SimpleVector(10, 10, 10));


results in this image:



and this code

xConeLeft = Primitives.getCone(90, 2);
xConeRight = Primitives.getCone(90, 2);
xConeRight.setAdditionalColor(new RGBColor(0, 0, 255));
xConeLeft.setAdditionalColor(new RGBColor(255, 0, 0));
xConeRight.rotateZ((float) -Math.PI/2);
xConeLeft.rotateZ((float) Math.PI/2);
xConeRight.strip();
xConeLeft.strip();
xConeRight.build();
xConeLeft.build();
world.addObject(xConeRight);
world.addObject(xConeLeft);

results in this image


however If I don't have xConeRight.rotateZ((float) -Math.PI/2);
then it all works fine.



[attachment deleted by admin]
#8
Support / setRotationPivot translates my object
September 18, 2013, 02:40:44 PM
Hi,

I am having a very hard time understanding how setRotationPivot works on AE version

When I do the following

xConeRight.setRotationPivot(new SimpleVector(15, 15, ,15));

it is the same as if I was doing

xConeRight.translate(30, 0, 0);

and then when I call rotateX or rotateY the object actually rotates around point (15, 0 ,0 )

I appreciate any help.