Skip to main content
added 262 characters in body
Source Link
Jacob
  • 2.6k
  • 3
  • 19
  • 50

From this topic: http://badlogicgames.com/forum/viewtopic.php?t=8573&p=38930

You should try not to do the following: (Quote from one of the GDX creators)

batch.begin();
shapes.begin();

.. draw stuff from both ...

shapes.end();
batch.end();

And from me - Don't use ShapeRenderer for drawing - it's for debugging purposes.

Instead of this create a 1x1px image with a white color and create a class like CustomLine which extends Actor and make it's draw() look like this:

public void draw(batch, parentalpha){
    batch.begin();
    batch.draw(smallpixelimage, getX(), getY(), getWidth(), getHeight());
    batch.end();
}

Just create an object of your new class CustomLine, add it to a stage/table or what you want and set it's size to 1x50 or something you like and you have your full-performance shaperenderer imitation ;)

But, if you really want a have a reason to use ShapeRenderer in your application, do it like:

batch.begin();
// draw graphics
batch.end();

shaperenderer.begin();
// draw shapes
shaperenderer.end();

and it will work.

From this topic: http://badlogicgames.com/forum/viewtopic.php?t=8573&p=38930

You should try not to do the following: (Quote from one of the GDX creators)

batch.begin();
shapes.begin();

.. draw stuff from both ...

shapes.end();
batch.end();

And from me - Don't use ShapeRenderer for drawing - it's for debugging purposes.

Instead of this create a 1x1px image with a white color and create a class like CustomLine which extends Actor and make it's draw() look like this:

public void draw(batch, parentalpha){
    batch.begin();
    batch.draw(smallpixelimage, getX(), getY(), getWidth(), getHeight());
    batch.end();
}

Just create an object of your new class CustomLine, add it to a stage/table or what you want and set it's size to 1x50 or something you like and you have your full-performance shaperenderer imitation ;)

From this topic: http://badlogicgames.com/forum/viewtopic.php?t=8573&p=38930

You should try not to do the following: (Quote from one of the GDX creators)

batch.begin();
shapes.begin();

.. draw stuff from both ...

shapes.end();
batch.end();

And from me - Don't use ShapeRenderer for drawing - it's for debugging purposes.

Instead of this create a 1x1px image with a white color and create a class like CustomLine which extends Actor and make it's draw() look like this:

public void draw(batch, parentalpha){
    batch.begin();
    batch.draw(smallpixelimage, getX(), getY(), getWidth(), getHeight());
    batch.end();
}

Just create an object of your new class CustomLine, add it to a stage/table or what you want and set it's size to 1x50 or something you like and you have your full-performance shaperenderer imitation ;)

But, if you really want a have a reason to use ShapeRenderer in your application, do it like:

batch.begin();
// draw graphics
batch.end();

shaperenderer.begin();
// draw shapes
shaperenderer.end();

and it will work.

Source Link
Jacob
  • 2.6k
  • 3
  • 19
  • 50

From this topic: http://badlogicgames.com/forum/viewtopic.php?t=8573&p=38930

You should try not to do the following: (Quote from one of the GDX creators)

batch.begin();
shapes.begin();

.. draw stuff from both ...

shapes.end();
batch.end();

And from me - Don't use ShapeRenderer for drawing - it's for debugging purposes.

Instead of this create a 1x1px image with a white color and create a class like CustomLine which extends Actor and make it's draw() look like this:

public void draw(batch, parentalpha){
    batch.begin();
    batch.draw(smallpixelimage, getX(), getY(), getWidth(), getHeight());
    batch.end();
}

Just create an object of your new class CustomLine, add it to a stage/table or what you want and set it's size to 1x50 or something you like and you have your full-performance shaperenderer imitation ;)