I'm able to draw triangles using the drawVerticies call, but I can't seem to get them to fill. Can any of you throw me a hint?
Here's what I'm doing...
Using java Syntax Highlighting
- //Early on, I create my blue paint and set the style to 'FILL'
- Paint pBlue = new Paint();
- pBlue.setColor(android.graphics.Color.BLUE);
- pBlue.setStyle(Paint.Style.FILL);
- //in my view's onDraw function...
- {
- ...
- canvas.drawCircle(250, 370, 30, pBlue);
- float [] points = new float[8];
- points[0] = 10;
- points[1] = 10;
- points[2] = 100;
- points[3] = 10;
- points[4] = 50;
- points[5] = 100;
- points[6] = 10;
- points[7] = 10;
- canvas.drawVertices(VertexMode.TRIANGLES, 8, points, 0, null, 0, null, 0, null, 0, 0, pBlue);
- ...
- }
Parsed in 0.033 seconds, using GeSHi 1.0.8.4
What happens is I get a filled circle (which is good).
But then the triangle draws just as a wireframe. It is not filled in. (which is bad)
I also tried leaving out the last point (10,10) which was an attempt to 'close' the triangle. In that case I use 6 as the second param to drawVertices. It still draws the same triangle and doesn't fill it.
So, it appears that 'FILL' works when doing rects or circles, but not for drawVertices. Is that expected, or am I doing this wrong?
Your wisdom is much appriciated.
-doma





