//
// main.cpp
// OpenGL-final
//
// Created by John&cat on 2020/4/27.
// Copyright © 2020 John&cat. All rights reserved.
// 可移动自行车
#define GL_SILENCE_DEPRECATION
#include <cmath>
#include <GLUT/GLUT.h>
#include "iostream"
using namespace std;
void init(void)
{
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT);
cout << "init.." << endl;
glLineWidth(1.0f);
glColor3f(1.0, 0.0, 0.0);
glMatrixMode(GL_PROJECTION);//设置投影矩阵
glLoadIdentity();
gluOrtho2D(0.0, 600.0, 0.0, 600.0);//二维视景区域 左下角为原点
//glClear(GL_COLOR_BUFFER_BIT);
//glMatrixMode(GL_MODELVIEW);
//glLoadIdentity();
}
int dir = 0;
int angle = 0;
// 绘制车轮
void DrawWheel(double x, double y, double r)
{
int sec = 10;
for (int i = 0; i <= sec; i++)
{
double delta = 3.1415926*2.0 / sec;
glBegin(GL_LINE_LOOP);
glVertex2f(x, y);
glVertex2f(
openGL-bike
最新推荐文章于 2022-04-18 12:09:24 发布