slimsallem7 / droidar

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

How to display Grid or Bitmap in BBox around the user #17

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi!
As the topic sais, i am trying to display raster data on a certain BoundingBox 
around the user position.
The raster data is a result of an interpolation with green-red color gradient.
The user should find himself "standing" on this raster data, hope you know what 
I mean...
With the newGrid method I was able to get this effect, by setting the camera 
perspective to Vec(0,0,1). 
But I see no way to fill the faces inside the Grid, cause they are just lines...
Unfortunately I am not able to get the Textured2dShape with my Bitmap to the 
same effect as the grid (lying on the floor).

Can you tell me how this could be possible?
Also if its possible to scale the Bitmap to certain BBox?

Thanks alot!

Original issue reported on code.google.com by raphael....@gmail.com on 5 Oct 2011 at 10:29

GoogleCodeExporter commented 9 years ago
ok so you have some bitmap objects (the raster data) and you want to create a 
box around the user with this bitmaps as textures? check the GLFactory there is 
some example code how to create textured shapes.

Original comment by simon.heinen on 5 Oct 2011 at 8:35

GoogleCodeExporter commented 9 years ago
Thanks,
so I was able to combine the Vec adding from the mesh with the Textured2dShape.
My only problem now is, that with the following code produces a triangle, not a 
rectangle:

Textured2dShape s = new Textured2dShape(IO.loadBitmapFromId(myTargetActivity, 
R.drawable.dummy), "imgName");
Vec start = new 
Vec(    s.myPosition.x-(s.getTextureWidth()/2),s.myPosition.y-(s.getTextureWidth()/
2), 0);
s.add(start.copy());                    // 1.
start.x += s.getTextureHeight();
s.add(start.copy());                    // 2.
start.y += s.getTextureWidth();
s.add(start.copy());                    // 3.
start.x -= s.getTextureHeight();
s.add(start.copy());                        // 4.

Do I have to close the "path" somehow?

Second question is: how can I ensure the right position of the image in the 
virtual coordinate system? Is there a wax to transform from geo-coordinates to 
virtual coords? 

kind regards!

Original comment by raphael....@gmail.com on 6 Oct 2011 at 8:44

GoogleCodeExporter commented 9 years ago
When you take a look at the GLFactory ( 
http://code.google.com/p/droidar/source/browse/trunk/droidar/DroidAR/src/gl/GLFa
ctory.java ) there is a method 

"public MeshComponent newTexturedSquare(String bitmapName, Bitmap bitmap,float 
size) {..."

take a look in there or use this method directly. The Textured2dShape is not 
the right choice here i think, bette use the TexturedShape like in the method. 

Its a triangle because opengl can only draw triangles so if you want to create 
a rectangle you have to use 2 triangles (like in the method;)

Original comment by simon.heinen on 6 Oct 2011 at 1:56

GoogleCodeExporter commented 9 years ago
Thanks alot Simon!
I will try that soon. My last little question: I saw a Blender3D Obj file in 
the raw folder and found the ObjParser. Does parsing this 3D models actually 
work?

Original comment by raphael....@gmail.com on 7 Oct 2011 at 10:12

GoogleCodeExporter commented 9 years ago
Jep, object parsing and displaying these objects (md3, obj, 3ds and some other 
i think, so also animated models!) does work but you will have to use the 
ModelLoaderAdapters project ( 
http://code.google.com/p/droidar/source/browse/#svn%2Ftrunk%2FModelLoaderAdapter
s ) and you will need the libgdx project ( http://code.google.com/p/libgdx/ ) 
to make the ModelLoaderAdapters work. But if you do so it is easy to load 
external models, just check the demo setup in the ModelLoaderAdapters.

Original comment by simon.heinen on 7 Oct 2011 at 3:20

GoogleCodeExporter commented 9 years ago
i finally did a short screencast about how to load 3d models: 
http://droidar.blogspot.com/2011/10/loading-external-3d-objects.html

Original comment by simon.heinen on 11 Oct 2011 at 11:25