openGL 实现绘制、修改多边形

使用鼠标和键盘进行多边形编辑。用户点击绘制位置,从上一点绘制到鼠标位置。可以移动顶点,删除顶点,以及执行刷新和退出操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Polyline Editor

Using a mouse and keyboard to do polyline editing.

  • A house in the process of being drawn. The user has just clicked at the position drawn, and a line has been drawn from the previous point to the one by the mouse.
  • Moving a point. The user positions the cursor near the vertex of some polyline, presses down the mouse button, and “drags” the chosen point to some other location before releasing the button. Upon release of the button, the previous lines connected to this point are erased, and new lines are drawn to it.
  • A point is deleted from a polyline. The user clicks near the vertex of some polyline, and the two line segments connected to that vertex are erased. Then the two other endpoints of the segments just erased are connected with a line segment.

The functionality of the program should include the following “actions”:

  • Begin (‘b’) (create a new polyline)
  • Delete (‘d’) (delete the next point pointed to)
  • Move (‘m’) (drag the point pointed to to a new location)
  • Refresh (‘r’) (erase the screen and redraw all the polylines)
  • Quit (‘q’) (exit from the program)
// ConsoleApplication1-openGL-lab1.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"

struct point {
    int x;
    int y;
    
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值