jPCT-AE - a 3d engine for Android > Support

Primary Flight Display HUD

<< < (2/4) > >>

EgonOlsen:
You could use a texture with an alpha channel, but that's tricky on transparent framebuffers if you mix it with opaque elements that intersect (in 2D) with the transparent ones.

bizart:
Hi,

 Working on HelloWorld example I have come up with the following at onSurfaceChanged:


--- Code: ---             // Horizon line texture
            TextureManager.getInstance().addTexture("horizon_texture", new Texture(getResources().openRawResource(R.raw.horizon_line), true));
           
            // Horizon background texture
            TextureManager.getInstance().addTexture("horizon_background_texture", new Texture(getResources().openRawResource(R.raw.horizon_back), true));
           
            horizon_background = Primitives.getPlane(1,1.6f);
            horizon_background.setTexture("horizon_background_texture");
            horizon_background.strip();
            horizon_background.build();
            horizon_background.translate(0, 0, 0.1f);
           
            world.addObject(horizon_background);            
           
            horizon_overlay = Primitives.getPlane(1,1.6f);
            horizon_overlay.setTexture("horizon_texture");
            horizon_overlay.strip();
            horizon_overlay.build();
            horizon_overlay.setTransparency(255);

            world.addObject(horizon_overlay);

            Camera cam = world.getCamera();
            cam.moveCamera(Camera.CAMERA_MOVEOUT, 1);
            cam.lookAt(horizon_overlay.getTransformedCenter());

--- End code ---

.. at onDrawFrame:


--- Code: --- if (touchTurn != 0) {
horizon_background.rotateZ(touchTurn);
horizon_overlay.rotateZ(touchTurn);
touchTurn = 0;
}

--- End code ---

.. So far i have notice few things:

 - Texture gradient on horizon_background(1024x1024) has a lot of strip lines..
 - Some how I cannot get how to setup correctly view from camera pointing to planes to fit on a screen(i.e. landscape) :)
 - During rotation after some turns appears a difference in rotation angle between two objects

Here you can check:
http://quadrodynamics.com/HelloWorld.apk

Thank you in advance!

EgonOlsen:
The gradients come from the frame buffer being only 16bit. You can either try to enable dithering in Config or configure a 32bit buffer in the surface setup of the Activity.
I'm not sure what exactly you mean with the second question and i can't spot the problem that you described in the third. Might be some inaccuracies in floating point math that add up in a way that things start to differ. Can't you simply use the same rotation matrix for all objects.

bizart:
Thank you EgonOlsen!

Config.glDither = true; Actually did solve the gradients issue..

I am trying to fill the entire view area with horizon(width should fit to screen diagonal), but don't know how could handle scale on different screens?

Did you mean rotating camera? There should be fixed "layer" (bird view and speed, altitude scales)..
Any idea for sliding scales representation?

EgonOlsen:
I'm not sure about the problem with filling the screen....maybe you can use the methods in Interact2D to calculate from screen coordinates back into 3D land and use that somehow to do the scaling? I've no exact idea how to do this ATM, but this might be a way...

No, i  meant to do something like obj1.setRotationMatrix(obj2.getRotationMatix());. That will assign the same matrix to both objects. Maybe that helps...

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version