// test2.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <GL/glut.h> #include "math.h" void display() { glClear(GL_COLOR_BUFFER_BIT); float alpha, radius, cx, cy; cx=25; cy=25; alpha = 0; radius = 20; glBegin(GL_LINE_STRIP); { for(float i=0; i<=360; i++) { alpha+=1; glVertex2f(radius * cos (alpha/180 * 3.1415) + cx, radius * sin(alpha/180 * 3.1415) + cy); } } glEnd(); glFlush(); } void myinit() { glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0.0, 50.0, 0.0, 50.0); glMatrixMode(GL_MODELVIEW); glClearColor(1.0,1.0,1.0,1.0); glColor3f(0.0,0.0,0.0); } int main(int argc, char* argv[]) { glutInit(&argc,argv); glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); glutInitWindowSize(500,500); glutInitWindowPosition(100,100); glutCreateWindow("testing1"); glutDisplayFunc(display); myinit(); glutMainLoop(); return 0; }
Senin, 13 Desember 2010
syntax membuat lingkaran di openGL; basic4GL
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar