我想用我的代码创建一个图形(2d图形),如何在opengl中创建一个简单的2d图形?我是opengl的新手,所以也许你可以解释一下我的代码是如何工作的.顺便说一句,这是我的代码:
#include <iostream>
using namespace std;
int main ()
{
double dt = 0.10; //(it is constant)
double t = 0.00;
double dx = 0.10; //(it is constant)
double x = 0.00;
double ddy = 1.00; //(it is constant)
double dy = 0.00;
double y = 1.00;
cout<<"t = "<<t<<endl;
cout<<"dx = "<<dx<<endl;
cout<<"x = "<<x<<endl;
cout<<"dy = "<<dy<<endl;
cout<<"y = "<<y<<endl;
cout<<endl;
while(t<=5)
{
x = x + dx*dt;
dy = dy - ddy * dt * dt;
y …Run Code Online (Sandbox Code Playgroud)