vianziro / droidar

Automatically exported from code.google.com/p/droidar
0 stars 0 forks source link

How to draw a 2d image #4

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi!

I would like to draw a simple 2D images to with droidar engine, but I don't 
know how to do that, could you help me please?

Thanks and good job!

Original issue reported on code.google.com by joanpuig...@gmail.com on 4 Jun 2011 at 10:23

GoogleCodeExporter commented 8 years ago
You can find some examples how to do it in the setup classes. Here is a code 
snipped how you can do it:

        Obj obj= new Obj();
        MeshComponent imageMesh = GLFactory.getInstance().newTexturedSquare(
                "uniqueImageId",
                IO.loadBitmapFromId(myTargetActivity, R.drawable.icon));
        imageMesh.addAnimation(new AnimationFaceToCamera(camera, 0.5f));
        obj.setComp(imageMesh);

The addAnimation(..) stuff is useful if you want the image to always face the 
camera

Original comment by simon.heinen on 5 Jun 2011 at 8:49

GoogleCodeExporter commented 8 years ago

Original comment by Alexande...@gmail.com on 30 Jun 2011 at 11:19

GoogleCodeExporter commented 8 years ago
in the 
imageMesh.addAnimation(new AnimationFaceToCamera(camera, 0.5f));

where is camera instantiated? I get an error there

Original comment by lordxy...@gmail.com on 23 Aug 2011 at 10:22

GoogleCodeExporter commented 8 years ago
The camera you need is a GLCamera and you have to create it on your own if you 
are using the normal Setup class. If you are using the DefaultARSetup class you 
can get the camera object by calling getCamera() inside your setup class. The 
best thing would be to take a look at the implementation of DefaultARSetup. The 
camera is needed when a new World object is created and you need it every time 
when the position in the virtual world (like facing a mesh to the user) is 
relevant.

Original comment by simon.heinen on 24 Aug 2011 at 9:01