use of com.badlogic.gdx.graphics.glutils.ImmediateModeRenderer in project commons-gdx by gemserk.
the class ImmediateModeRendererUtils method drawLine.
public static void drawLine(float x0, float y0, float x1, float y1, Color color) {
ImmediateModeRenderer renderer = getRenderer();
renderer.begin(getProjectionMatrix(), GL10.GL_LINES);
{
renderer.color(color.r, color.g, color.b, color.a);
renderer.vertex(x0, y0, 0);
renderer.color(color.r, color.g, color.b, color.a);
renderer.vertex(x1, y1, 0);
}
renderer.end();
}
use of com.badlogic.gdx.graphics.glutils.ImmediateModeRenderer in project commons-gdx by gemserk.
the class ImmediateModeRendererUtils method drawPolygon.
public static void drawPolygon(Vector2[] vertices, float x, float y, float angle, Color color) {
GL10 gl = Gdx.graphics.getGL10();
gl.glPushMatrix();
gl.glTranslatef(x, y, 0f);
gl.glRotatef(angle, 0f, 0f, 1f);
ImmediateModeRenderer renderer = getRenderer();
renderer.begin(getProjectionMatrix(), GL10.GL_LINE_LOOP);
for (int i = 0; i < vertices.length; i++) {
Vector2 v = vertices[i];
renderer.color(color.r, color.g, color.b, color.a);
renderer.vertex(v.x, v.y, 0);
}
renderer.end();
gl.glPopMatrix();
}
use of com.badlogic.gdx.graphics.glutils.ImmediateModeRenderer in project commons-gdx by gemserk.
the class ImmediateModeRendererUtils method draw.
public static void draw(Triangulator triangulator, float x, float y, float angle, Color color) {
GL10 gl = Gdx.graphics.getGL10();
gl.glPushMatrix();
gl.glTranslatef(x, y, 0f);
gl.glRotatef(angle, 0f, 0f, 1f);
ImmediateModeRenderer renderer = getRenderer();
renderer.begin(getProjectionMatrix(), GL10.GL_TRIANGLES);
for (int i = 0; i < triangulator.getTriangleCount(); i++) {
for (int p = 0; p < 3; p++) {
float[] pt = triangulator.getTrianglePoint(i, p);
renderer.color(color.r, color.g, color.b, color.a);
renderer.vertex(pt[0], pt[1], 0f);
}
}
renderer.end();
gl.glPopMatrix();
}
use of com.badlogic.gdx.graphics.glutils.ImmediateModeRenderer in project commons-gdx by gemserk.
the class ImmediateModeRendererUtils method fillRectangle.
public static void fillRectangle(float x0, float y0, float x1, float y1, Color color) {
ImmediateModeRenderer renderer = getRenderer();
renderer.begin(getProjectionMatrix(), GL10.GL_TRIANGLES);
{
// first triangle
renderer.color(color.r, color.g, color.b, color.a);
renderer.vertex(x0, y0, 0f);
renderer.color(color.r, color.g, color.b, color.a);
renderer.vertex(x0, y1, 0f);
renderer.color(color.r, color.g, color.b, color.a);
renderer.vertex(x1, y1, 0f);
// second triangle
renderer.color(color.r, color.g, color.b, color.a);
renderer.vertex(x1, y1, 0f);
renderer.color(color.r, color.g, color.b, color.a);
renderer.vertex(x1, y0, 0f);
renderer.color(color.r, color.g, color.b, color.a);
renderer.vertex(x0, y0, 0f);
}
renderer.end();
}
use of com.badlogic.gdx.graphics.glutils.ImmediateModeRenderer in project commons-gdx by gemserk.
the class ImmediateModeRendererUtils method drawSolidCircle.
public static void drawSolidCircle(float x, float y, float radius, Color color) {
ImmediateModeRenderer renderer = getRenderer();
renderer.begin(getProjectionMatrix(), GL10.GL_LINE_LOOP);
{
float angle = 0;
float angleInc = 2 * (float) Math.PI / 20;
for (int i = 0; i < 20; i++, angle += angleInc) {
tmp.set((float) Math.cos(angle) * radius + x, (float) Math.sin(angle) * radius + y);
renderer.color(color.r, color.g, color.b, color.a);
renderer.vertex(tmp.x, tmp.y, 0);
}
}
renderer.end();
}
Aggregations