| | |
opengl circle drowing
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Nov 2008
Posts: 21
Reputation:
Solved Threads: 0
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
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
![]() |
Other Threads in the C++ Forum
- Previous Thread: Need a little help!
- Next Thread: Hangman help
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays assignment beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete developer display dll email encryption error file forms fstream function functions game generator getline givemetehcodez graph homeworkhelper iamthwee ifstream image input int java lazy lib loop looping loops map math matrix memory multidimensional multiple newbie news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return sorting string strings struct template templates text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






