OpenGL - Filling an object

Hey guys...

I'm experimenting with filling an object with colors.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
void drawRotatingObject( const Point & center, int rotation)
{
   struct PT
   {
      int x;
      int y;
   } points[] = 
   {
      {0, 12},    {8, 20}, {16, 14},
      {10, 12},   {20, 0}, {0, -20},
      {-18, -10}, {-20, -2}, {-20, 14},
      {-10, 20},  {0, 12}
   };
   
   glBegin(GL_LINE_STRIP);
   //The outside now has a blue greenish color
   glColor3f(0.0 /* red % */, 3.2 /* green % */, 2.0 /* blue % */); 
      for (int i = 0; i < sizeof(points)/sizeof(PT); i++)
   {
      Point pt(center.getX() + points[i].x, 
               center.getY() + points[i].y);
      rotate(pt, center, rotation);
      glVertex2f(pt.getX(), pt.getY());
   }
   glColor3f(1.0, 1.0, 1.0);
   glEnd();
}


Does anyone could show me how to fill this object without distorting it?

Thanks,
Assuming your point values are appropriate, interpret them as a polygon rather than a line strip, otherwise you'll have to convert your data to a different format.

Is there a reason you're using (the rather out-dated) immediate mode?
Thanks, It worked.


There is no reason why using an out-dated mode. It was what a friend taught me and I'm just experimenting with it.

closed account (48T7M4Gy)
@cire says:
But, hey.. keep talking out of your ass and filling the forums with misinformation and novice code while pretending you're an expert. I'm sure you're impressing yourself.


This sort of disgraceful language, exaggeration and bullying will not be tolerated Cire. Stop it and apologise...
closed account (3h0oLyTq)
@kemort
How strange. Cire does not really make an appearance in this thread...
closed account (48T7M4Gy)
it's not strange, the more people who know about the pathology of cires cowardly bullying the better. It's been going on here for too long.
Topic archived. No new replies allowed.