Get verticies from shape/body

Ive got two for loops going to get the bodies from my world and then the shapes from my bodies, is there any way to then get the verticies from the shape (if it is a polygon) or the radius (if it is a circle). I had quite a thorough dig around in the b2Shape.h and b2Shape.cpp code but I couldn't find anything. I really need this if I want to render it using opengl (as I want to draw lines from each verticy to the other, like in the debug draw, and I have a function to render a circle given the centre and the radius.

is this because:
1. Its simply not possible.
2. I should be getting the b2PolygonShape or b2CircleShape from the body and if so how should I do this.

here is my code if it is any help

Code:
printf("{\n");

for (b2Body* b = myWorld->GetBodyList(); b; b = b->GetNext())
   {
      printf("   {\n");
      b2Vec2 position = b->GetPosition();
      float32 angle = b->GetAngle();
      printf("      %4.2f %4.2f %4.2f\n", position.x, position.y, angle);
      //b->WakeUp();
      for (b2Shape* s = b->GetShapeList(); s; s = s->GetNext())
      {
         b2ShapeType SHAPETYPE = s->GetType();
         switch(SHAPETYPE){
            case -1:
               printf("      Unknown Shape\n");
            break;
            case 0:
               printf("      Circle Shape\n");
               //b2CircleShape* CS = s;
               //float RAD = s->GetRadius();
               //printf("%f\n",RAD);
            break;
            case 1:
               printf("      Polygon Shape\n");
            break;
            case 2:
               printf("      Shape type count\n");
            break;
            default:
               printf("      ????????\n");
            break;
         }
      }
      printf("   }\n");
   }
   printf("}\n");


Thanks in advance!

ps, Im working in c++
The Box2D debug draw knows how to draw the vertices. You should look at that.
Im trying not to use the debugdraw as I want the code to be as flexible as possibe, and I would prefer to try and do all of it myself as a learning excersise
For your code to be as flexible as possible, you need to forget about getting vertices from Box2D. Try this instead :

When you create your shapes, create their equivalent somewhere(ex: you create a box, create a Box object with the same vertices). When you loop through your shapes, get back the equivalent object you created and render this object using the body's x, y and angle values. Look up on transformation matrices to know how to transform your vertices to the correct position. If you apply a rotation matrix followed by a translation matrix, your Box's vertices will be at the correct position when rendered.

This is important because Box2D doesn't know or care what the shapes represent. It may seem like more work than what is needed, but the day you want a box to be more than a box, say a wooden or steel box, relying on Box2D's data will not be sufficient. Also, this is the standard technique used by pretty much every rendering engine, so you should find plenty of examples and documentation on the subject.

Have fun!
thanks for that, and I will consider that method of using the data when I need to do more than I do now.
At the moment, Im just learning and all I really want to do is create a VERY simple (single file) example using box2d I realise that using the vertices is not pretty but its all I want to do right now.

(oh, and I found what I wanted to do by going through the box2d source code, its in b2world.cpp)
sorry for double post, but could you give me a hint as to how to build a rotation matrix? as I've looked up b2Xform and it seems to be what I want for positioning the vertices of polygons, but it needs a rotation matrix, and I'm not sure how to go about making one, let alone using it.

Thanks!

Original thread: https://box2d.org/forum/viewtopic.php?t=3277