jrealpe / droidar

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

TexturedSquare bug #31

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. creating a texturedsquare with a bitmap with the glfactory.
2. adding it to the world.

What is the expected output? What do you see instead?
A square. a triangle.

What version of the product are you using? On what operating system?
260 DroidAr, 243 ARMarker

Please provide any additional information below.
-

Original issue reported on code.google.com by saschafr...@gmail.com on 9 Feb 2012 at 7:38

GoogleCodeExporter commented 9 years ago
I need a little bit more info than this? If you run the demo apk, are the 
images all displayed correctly? most of the example setups use the textured 
square methods from the glfactory. what device are you using and can you 
provide your code. did you do any other modifications to the opengl environment?

Original comment by simon.heinen on 9 Feb 2012 at 10:50

GoogleCodeExporter commented 9 years ago
On my startup(using MarkerDetectionSetup) i do this 
@_a3_registerMarkerObjects(MarkerObjectMap markerObjectMap) {
        this.markerObjectMap = markerObjectMap;

 i load all needed figure objects with the modelloader from gdx and for this special problem i use the glfactory to create a huge square.

This is the code for creating my square:
String bitmapName = "bla";
    MeshComponent boardMarkerMesh = new Shape(Colors.defaultBoardPlatformColor); // color is (new Color(0,0, 0, 1))
        MeshComponent boardSquare = glFactory.newTexturedSquare(bitmapName,b, squareSize); //squareSize is 32f //b is a random picture on my harddrive

//here starts my workaround
boardSquare.setRotation(new Vec(0, 180, 0)); //180°  Rotation for mirroring

    boardMarkerMesh.addChild(boardSquare);

    Matrix matrixMirrorY = new Matrix();
    matrixMirrorY.setValues(new float[]{ -1, 0, 0, 0, -1, 0, 0, 0, 1 }); //Mirroring in X , Y 

    Matrix matrix = new Matrix();
    matrix.postConcat(matrixMirrorY);

    Bitmap mirrorBitmap = Bitmap.createBitmap(b, 0, 0,
        b.getWidth(),
        b.getHeight(), matrix, true);

    boardSquare = glFactory.newTexturedSquare(bitmapName+"Mirrored",
        mirrorBitmap, squareSize);
    //end of workaround
    boardMarkerMesh.addChild(boardSquare);
    boardMarkerMesh.setRotation(VecContainer.Rotations.VEC_90DEGREE_X); //To display a plane image on a marker

i didn't change any opengl environment setting on my own, just used the ones 
you made in the tutorials or in the trunk code.

i use the xperia mini from sony ericcson android 2.3.3

Thanks for your fast answer 

Original comment by saschafr...@gmail.com on 10 Feb 2012 at 11:02

GoogleCodeExporter commented 9 years ago
Up to this post.

I have same problem. When I want to load texturedSquare, I see a triangle 
instead a square.

My simple code :

GeoObj o = new GeoObj(44.8816, -0.741534);
        MeshComponent mesh = GLFactory.getInstance().newTexturedSquare("arrow", IO.loadBitmapFromId(myTargetActivity, R.drawable.arrow));
        o.setComp(mesh);
        world.add(o);

The image I try to load : http://kyochan.free.fr/arrow.png

Note that when I try to add GLText that each letter is half cut too (triangle 
instead square)

GeoObj o = new GeoObj(44.8816, -0.741534);
        HashMap<String, MeshComponent> textMap = new HashMap<String, MeshComponent>();
        GLText text = new GLText("test", myTargetActivity, textMap, getCamera());
        text.addAnimation(new AnimationFaceToCamera(camera, 0.5f));

Device : HTC Desire
DroidAR svn revision : 343

Original comment by pphom...@gmail.com on 23 May 2012 at 12:59

GoogleCodeExporter commented 9 years ago
hm thats really strange, it sounds like open gl is using culling, but I 
switched it of a long time ago and if you did not change anything and using 
normal unmodified Android phones I dont really know why this happens :/

Again this is important: If you run the demo apk, are the images all displayed 
correctly? If so its because you are using an old version of opengl or its 
somewhere in the marker code. You can search the marker project for 
GL10.GL_CULL_FACE and if you find it, and there is something like 
gl.glEnable(GL10.GL_CULL_FACE); remove it and check if it works.

Original comment by simon.heinen on 23 May 2012 at 3:39

GoogleCodeExporter commented 9 years ago
Got it !

Actually DroidAR project source code works normally even there are 
gl.glEnable(GL10.GL_CULL_FACE) and gl.glDisable(GL10.GL_CULL_FACE) lines in 
Shape.java class.

But I use the modelLoaderAdapters project source code and in GDXMesh.java class 
there is gl.glEnable(GL10.GL_CULL_FACE) line in draw function. I comment it and 
the 2D texture are now displayed correctly.

Thank you for the hint.

Original comment by pphom...@gmail.com on 23 May 2012 at 4:55