Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3403616
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:16:58+00:00 2026-05-18T05:16:58+00:00

I’m trying to draw a circle in c using opengl, that’s smaller than the

  • 0

I’m trying to draw a circle in c using opengl, that’s smaller than the one shown. The problem is I can’t seem to find how to reduce the size of it…Can anyone help me?

#define GLUT_DISABLE_ATEXIT_HACK
#include <GL/gl.h>
#include <GL/glut.h>
#include <stdio.h>

#include <math.h>
#define PI 3.1415926535898
GLint circle_points =100;
 // This is the draw function.
void draw()
{

glClear(GL_COLOR_BUFFER_BIT);
double angle = 2*  PI/circle_points ;
glPolygonMode( GL_FRONT, GL_FILL );
glColor3f(0.2, 0.5, 0.5 );
glBegin(GL_POLYGON);
    double angle1=0.0;
    glVertex2d( cos(0.0) , sin(0.0));
    int i;
    for ( i=0 ; i< circle_points ;i++)
    {
        printf( "angle = %f \n" , angle1);
        glVertex2d(cos(angle1),sin(angle1));
        angle1 += angle ;
    }
glEnd();
glFlush();
}

void init()
{
glClearColor(0.0,0.0,0.0,0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0,1.0,-1.0,1.0,-1.0,1.0);
}

void keyboard (unsigned char key , int x, int y)
{
exit(0);

}

void main( int argc,char **argv)
 {
     glutInit(&argc,argv);
 glutInitDisplayMode(GLUT_SINGLE |GLUT_RGB);
 glutInitWindowSize(250,250);
 glutInitWindowPosition(100,100);
 glutCreateWindow("ch06");
 init();
 glutKeyboardFunc(keyboard);
 glutDisplayFunc(draw);
        glutMainLoop();
 }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T05:16:58+00:00Added an answer on May 18, 2026 at 5:16 am

    You can change the line:

        glVertex2d(cos(angle1),sin(angle1)); 
    

    to:

        glVertex2d(0.25f * cos(angle1),0.25f * sin(angle1)); 
    

    That will draw a circle with a radius of 0.25 instead of 1.

    Edit: As spotted by Dasen, you also need to add the 0.25f * to the line:

        glVertex2d(cos(0.0),sin(0.0)); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm making a simple page using Google Maps API 3. My first. One marker
I am trying to loop through a bunch of documents I have to put
We're building an app, our first using Rails 3, and we're having to build
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have some data like this: 1 2 3 4 5 9 2 6

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.