Author Topic: Full-Circle  (Read 2335 times)

0 Members and 1 Guest are viewing this topic.

Peter

  • Guest
Full-Circle
« on: April 30, 2013, 05:02:37 AM »
Deleted
« Last Edit: May 05, 2015, 11:32:36 AM by Peter »

Charles Pegge

  • Guest
Re: Full-Circle
« Reply #1 on: April 30, 2013, 06:45:09 AM »
Hi Peter, Does this work?

single x=100, y=100, a, radius=40, ra

glBegin GL_LINE_LOOP
  for angle a=0 to 360 step 5
      ra=rad(a)
      glVertex2f(x + sin(ra) * radius, y + cos(ra) * radius)
  next
glEnd


setting a prototype:
! Color4ub (byte r,g,b,a) at GlColor4ub
Color4ub r,g,b,a
« Last Edit: April 30, 2013, 06:53:34 AM by Charles Pegge »

Charles Pegge

  • Guest
Re: Full-Circle
« Reply #2 on: April 30, 2013, 11:38:35 AM »
I found integer and float vertices scale the same way

 sub scene(sys hWnd)
  '==================
  '
  static single s1,s2,s3,s4,ang1,angi1=1
  '
  glLoadIdentity
  glClear GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT
  glClearColor 0.5, 0, 0, 0
  '
  '
  glrotatef    ang1, 0,0,1.0
  gltranslatef 0,0,-1.0
  glscalef     0.001,0.001,0.001
  '
  glLineWidth 3.0
  '
  glBegin GL_LINES
  glColor4ub  250,250,150,250
  glVertex2i -100,-100
  glVertex2i  100, 100
  glColor4ub  150,250,250,250
  glVertex2i -100, 100
  glVertex2i  100,-100
  glEnd
  '
  glLineWidth 2.0
  '
  glBegin GL_LINE_LOOP
  for i=0 to 360 step 10
    ra=rad(i)
    glVertex2f cos(ra)*170,sin(ra)*170
  next
  glEnd
  '
  ang1+=angi1
  if ang1>360 then ang1-=360
  '
  end sub
« Last Edit: April 30, 2013, 11:57:49 AM by Charles Pegge »

Charles Pegge

  • Guest
Re: Full-Circle
« Reply #3 on: April 30, 2013, 01:40:03 PM »
If you want a solid circle then use glBegin GL_TRIANGLE_FAN ..
Give the centre vertex first, then vertices around the circumference.

This produces polygons all the way to a smooth circle according to the step angle.

Charles Pegge

  • Guest
Re: Full-Circle
« Reply #4 on: April 30, 2013, 02:13:56 PM »
CrisCrossing? did you remember to convert the angle to radians.

Charles Pegge

  • Guest
Re: Full-Circle
« Reply #5 on: May 01, 2013, 05:47:50 AM »
Can't see much when you send binaries.