943,772 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 3452
  • C++ RSS
Nov 8th, 2008
0

opengl circle drowing

Expand Post »
hiiiiiiiiiiiiiiiiiiiiiiii

i'v a problem with dowing a circle in opengl
I want to drow a fram of circles but my circle function did not implemented

this the code that I try

#include <windows.h>
#include <gl\gl.h>
#include <gl\glu.h>
#include <gl\glut.h>
#include <math.h>

static void redraw(void);
int main(int argc, char **argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutInitWindowPosition(100,100);
glutInitWindowSize(400,400);
glutCreateWindow("draw circle");
glutDisplayFunc(redraw);
glMatrixMode(GL_PROJECTION);
gluPerspective(45,1.0,10.0,200.0);
glMatrixMode(GL_MODELVIEW);
glutMainLoop();
return 0;
}

static void redraw(void)
{
#define PI 3.14159265
#define EDGES 90
#define factor 10
glClearColor(1.0,1.0,1.0,0.0);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glColor3f(0.0,0.0,0.0);
glTranslatef(0.0,0.0,-100.0);
for (int i = 0; i < EDGES; i++) {
glBegin(GL_LINE_LOOP);
glVertex2f(factor*cos((2*PI*i)/EDGES),factor*sin((2*PI*i)/EDGES));
glVertex2f(factor*cos((2*PI*(i+1))/EDGES),factor*sin((2*PI*(i+1))/EDGES));
glEnd();
}
glutSwapBuffers();
}


any ideas
Reputation Points: 7
Solved Threads: 0
Newbie Poster
the_swan is offline Offline
21 posts
since Nov 2008
Nov 8th, 2008
1

Re: opengl circle drowing

Look up the way GL_LINE_LOOP is supposed to work and then look at your code.
Team Colleague
Reputation Points: 1135
Solved Threads: 171
Super Senior Demiposter
Rashakil Fol is offline Offline
2,478 posts
since Jun 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Need a little help!
Next Thread in C++ Forum Timeline: Hangman help





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC