Я хочу создать круги с логотипом Audi: [img]https://i.sstatic.net/FNu4jeVo.png[/img]
Однако результат моего кода: [code]#define PI 3.14159265358979323846 #ifdef __APPLE_CC__ #include #else #include #endif #include #include
float zoom = 1.0f; void init() { // Set the background color to white glClearColor(1.0, 1.0, 1.0, 1.0); // Set up the viewport glViewport(0, 0, 500, 500); // Initialize the projection matrix glMatrixMode(GL_PROJECTION); glLoadIdentity();
// Initial zoom setup, centering at the origin float range = 5.0 * zoom; gluOrtho2D(-range, range, -range, range);
// Initialize the modelview matrix glMatrixMode(GL_MODELVIEW); glLoadIdentity(); }
void drawCircle(GLfloat x, GLfloat y, GLfloat radius, GLint numberOfSides, GLfloat r, GLfloat g, GLfloat b, GLfloat alpha) { glColor4f(r, g, b, alpha); glBegin(GL_POLYGON); for (int i = 0; i < numberOfSides; i++) { GLfloat angle = 2.0f * PI * i / numberOfSides; glVertex2f(x + cos(angle) * radius, y + sin(angle) * radius); } glEnd(); }
void display() { // Clear the color buffer glClear(GL_COLOR_BUFFER_BIT); // Draw circles with specified fills drawCircle(3.0, 0.0, 2.0, 100, 0.3921f, 0.4313f, 0.4470f, 1.0f); // outer circle 1 drawCircle(3.0, 0.0, 1.5, 100, 1.0f, 1.0f, 1.0f, 1.0f); // innermost circle 1
int main(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); glutInitWindowSize(800, 800); glutInitWindowPosition(100, 100); glutCreateWindow("Mercedes Logo with Circle"); init(); // Register display callback function glutDisplayFunc(display); glutMainLoop(); return 0; } [/code] ...это не то, что я ожидал: [img]https://i. sstatic.net/oTRZGo1A.jpg[/img]