خرید بک لینک

gameover.blog.ir


#include <windows.h> // For MS Windows

#include <GL/glut.h> // GLUT, includes glu.h and gl.h

#include <math.h>


void drawCircle(double radius)

{

//filled circle

float x1,y1,x2,y2;

float angle;

//radius=0.1;


x1 = 0.5,y1=0.6;

glColor3f(1.0,1.0,0.6);


glBegin(GL_TRIANGLE_FAN);

glVertex2f(x1,y1);


for (angle=1.0f;angle<361.0f;angle+=0.2)

{

x2 = x1+sin(angle)*radius;

y2 = y1+cos(angle)*radius;

glVertex2f(x2,y2);

}


glEnd();

}


void display(){

drawCircle(0.1f);

glFlush(); // Render now

}


int main(int argc, char** argv) {

glutInit(&argc, argv); // Initialize GLUT

glutCreateWindow("OpenGL Setup Test"); // Create a window with the given title

glutInitWindowSize(320, 320); // Set the window's initial width & height

glutInitWindowPosition(50, 50); // Position the window's initial top-left corner

glutDisplayFunc(display); // Register display callback handler for window re-paint

glutMainLoop(); // Enter the infinitely event-processing loop

return 0;

}



دقت کنید که سه فایل glu32.dll + glut32.dll+opengl32.dll رو باید در مسیر C:WindowsSystem32 داشته باشید.

فایل math.h هم باید تو پوشه ی header یا فایل های کتابخانه ای ویژال استادیو و ویژوال سی باشه.

برچسب: نویسنده: ایلیا حیدری تاريخ: پنجشنبه 21 دی 1396 ساعت: 11:54

صفحه بندی