Skip navigation

Category Archives: OpenGL

Testing Google – Android promotion:

http://developer.android.com/distribute/googleplay/promote/badges.html

 

Here the code:

<a href=”https://play.google.com/store/apps/details?id=es.moodbox.android.daemondice”>
<img alt=”Get it on Google Play”
src=”https://developer.android.com/images/brand/en_generic_rgb_wo_60.png” />
</a>

 

How to add easy custom menu links to a WP:

1) Clicked on Appearance ->Widgets

2)Dropped and dragged the Text Widget into the East Sidebar
3)Inserted HTML code for the link
4)Hit Save

It will convert the screen coordinates to the created 3D world.

projectionDepth: is the camera Z

public Number3D screenToWorld(float x, float y, int viewportWidth, int viewportHeight, float projectionDepth)
{
float[] r1 = new float[16];
int[] viewport = new int[] { 0, 0, viewportWidth, viewportHeight };

GLU.gluUnProject(x, viewportHeight – y, 0.0f, mCamera.getViewMatrix(), 0, mCamera.getProjectionMatrix(), 0, viewport, 0, r1, 0);

//take the normalized vector from the resultant projection and the camera, and then project by the desired distance from the camera.
Number3D result = new Number3D(-r1[0], r1[1], r1[2]);
result.subtract(mCamera.getPosition());
result.normalize();
result.multiply(projectionDepth);
result.add(mCamera.getPosition());
return result;
}