Graphics not drawing correctly when adding more than 1

Problems with Canvas, OpenGL, etc...

Graphics not drawing correctly when adding more than 1

Postby acriib » Sun Oct 31, 2010 6:54 pm

Hi I'm having a problem with the first graphic being drawn to x0 y0 in my code. what I have is a column of 7 graphics(_theGrid) and when I remove a graphic from it, a new graphic is created in _toAdd. What my code is doing taking what ever is in _toAdd array and adding it to _theGrid array.

If I only add the first graphic, the graphic is drawn CORRECTLY to x63 y63

if I add both, the first is drawn INCORRECTLY to x0 y0, and the second graphic is drawn CORRECTLY to x63 y126

if I add a third, the the first TWO are drawn INCORRECTLY and the last is drawn correctly.

I have tried invalidate and postInvalidate with no success and have hit a wall.

Can anyone here help me remedy this problem, I am totally stumped here :?
I am obviously missing something Im just not sure what.

Code: Select all

                           //FIRST GRAPHIC TO ADD FROM THE _toAdd ARRAY
                           x=63;
                           y=63;
                           graphic.getGridCoordinates().setGrid1X(x);
                                      graphic.getGridCoordinates().setGrid1Y(y);
                                      _toMove.add(_toAdd.get(0));
                           _theGrid.add(0,_toAdd.get(0));
                           _theGrid.get(0).setAMT(_theGrid.get(0).getAMT()+2);
                           _theGrid.get(0).setMV(11);
                           _toAdd.remove(_theGrid.get(0));


                                                //SECOND GRAPHIC TO ADD FROM THE _toAdd ARRAY
                           x=63;
                           y=126;
                           graphic.getGridCoordinates().setGrid1X(x);
                                      graphic.getGridCoordinates().setGrid1Y(y);
                                      _toMove.add(_toAdd.get(0));
                           _theGrid.add(0,_toAdd.get(0));
                           _theGrid.get(0).setAMT(_theGrid.get(0).getAMT()+2);
                           _theGrid.get(0).setMV(12);
                           _toAdd.remove(_theGrid.get(0));






I have the following running in OnDraw(Canvas canvas) non stop

Code: Select all
bitmap = _theGrid.get(0).getBitmap();
            gridcoords = _theGrid.get(0).getGridCoordinates();
            canvas.drawBitmap(bitmap, gridcoords.getGrid1X(), gridcoords.getGrid1Y(), null);
acriib
Freshman
Freshman
 
Posts: 7
Joined: Sun Oct 03, 2010 7:05 pm

Top

Return to Android 2D/3D Graphics - OpenGL Problems

Who is online

Users browsing this forum: No registered users and 2 guests