资源简介
opengl的鼠标画线,圆,矩形,还有个菜单,很适合opengl初学者学习

代码片段和文件信息
#include
#include
GLsizei winWidth = 800 winHeight = 600; // 窗口的大小
GLfloat red = 1.0 green = 0.0 blue = 0.0; //颜色
GLenum fillMode = GL_SMOOTH;
bool LineCircleRectanger;
int xstartystartxendyend;//鼠标的坐标
float r;//圆的半径
int NUM=200;// 定义绘制圆时用的顶点数(用顶点组成的线段逼近圆)(new)
void fillOption(GLint s){
//glutPostRedisplay();
}
void graphics(GLint selectedOption)
{
switch (selectedOption) {
case 1:Line=trueCircle=falseRectanger=false; break;
case 2:Line=falseCircle=trueRectanger=false; break;
case 3:Line=falseCircle=falseRectanger=true; break;
}
// glutPostRedisplay ( );
}
void colorselection(GLint selectedOption)
{
switch (selectedOption) {
case 1:red = 1.0 green = 0.0 blue = 0.0; break;
case 2:red = 0.0 green = 1.0 blue = 0.0; break;
case 3:red = 0.0 green = 0.0 blue = 1.0; break;
}
// glutPostRedisplay ( );
}
void mousemove(int xmoveint ymove)
{
if(Line){
glEnable(GL_COLOR_LOGIC_OP);
glLogicOp(GL_XOR);
glBegin(GL_LINES);
glVertex2i(xstartystart);
glVertex2i(xendyend);
glEnd();
xend=xmove;
yend=winHeight-ymove;
glBegin(GL_LINES);
glVertex2i(xstartystart);
glVertex2i(xendyend);
glEnd();
glFlush();
}
else if(Rectanger){
glEnable(GL_COLOR_LOGIC_OP);//启动逻辑异或
glLogicOp(GL_XOR);
glBegin(GL_LINE_LOOP);
glVertex2i(xstartystart);
glVertex2i(xstartyend);
glVertex2i(xendyend);
glVertex2i(xendystart);
//glVertex2i(xstartystart);
glEnd();
xend=xmove;
yend=winHeight-ymove;
glBegin(GL_LINE_LOOP);
glVertex2i(xstartystart);
glVertex2i(xstartyend);
glVertex2i(xendyend);
glVertex2i(xendystart);
// glVertex2i(xstartystart);
glEnd();
glFlush();
}
else if(Circle){
glEnable(GL_COLOR_LOGIC_OP);//启动逻辑异或
glLogicOp(GL_XOR);
r=sqrt((xstart-xend)*(xstart-xend)+(ystart-yend)*(ystart-yend)*1.0)/2; //计算圆的半径
glBegin(GL_LINE_LOOP); // 绘制圆(new)
for(int i=0; i {
glVertex2f((xstart+xend)/2+r*float(sin(2*3.14*i/NUM))(ystart+yend)/2+ r*float(cos(2*3.14*i/NUM)));
}
glEnd(); // 圆绘制结束
xend=xmove;
yend=winHeight-ymove;
r=sqrt((xstart-xend)*(xstart-xend)+(ystart-yend)*(ystart-yend)*1.0)/2; //计算圆的半径
glBegin(GL_LINE_LOOP); // 绘制圆(new)
for(int i=0; i {
glVertex2f((xstart+xend)/2+r*float(sin(2*3.14*i/NUM))(ystart+yend)/2+ r*float(cos(2*3.14*i/NUM)));
}
glEnd(); // 圆绘制结束
glFlush();
}
}
void mouseud (int btnint stateint xint y)
{
if(Line){
if
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 37376 2009-10-27 19:44 opengl的鼠标画线,圆,矩形,还有个菜单,很适合opengl初学者学习\interGraphics\Debug\interGraphics.exe
文件 350084 2009-10-27 19:44 opengl的鼠标画线,圆,矩形,还有个菜单,很适合opengl初学者学习\interGraphics\Debug\interGraphics.ilk
文件 420864 2009-10-27 19:44 opengl的鼠标画线,圆,矩形,还有个菜单,很适合opengl初学者学习\interGraphics\Debug\interGraphics.pdb
文件 10910 2009-10-27 19:44 opengl的鼠标画线,圆,矩形,还有个菜单,很适合opengl初学者学习\interGraphics\interGraphics\Debug\BuildLog.htm
文件 24964 2009-10-27 19:44 opengl的鼠标画线,圆,矩形,还有个菜单,很适合opengl初学者学习\interGraphics\interGraphics\Debug\Graphics.obj
文件 663 2009-10-27 19:44 opengl的鼠标画线,圆,矩形,还有个菜单,很适合opengl初学者学习\interGraphics\interGraphics\Debug\interGraphics.exe.em
文件 728 2009-10-27 19:44 opengl的鼠标画线,圆,矩形,还有个菜单,很适合opengl初学者学习\interGraphics\interGraphics\Debug\interGraphics.exe.em
文件 621 2009-10-27 19:44 opengl的鼠标画线,圆,矩形,还有个菜单,很适合opengl初学者学习\interGraphics\interGraphics\Debug\interGraphics.exe.intermediate.manifest
文件 67 2009-10-27 19:44 opengl的鼠标画线,圆,矩形,还有个菜单,很适合opengl初学者学习\interGraphics\interGraphics\Debug\mt.dep
文件 44032 2009-10-27 19:44 opengl的鼠标画线,圆,矩形,还有个菜单,很适合opengl初学者学习\interGraphics\interGraphics\Debug\vc90.idb
文件 53248 2009-10-27 19:44 opengl的鼠标画线,圆,矩形,还有个菜单,很适合opengl初学者学习\interGraphics\interGraphics\Debug\vc90.pdb
文件 7686 2009-10-27 19:44 opengl的鼠标画线,圆,矩形,还有个菜单,很适合opengl初学者学习\interGraphics\interGraphics\Graphics.cpp
文件 3932 2009-10-26 18:03 opengl的鼠标画线,圆,矩形,还有个菜单,很适合opengl初学者学习\interGraphics\interGraphics\interGraphics.vcproj
文件 1427 2009-10-27 20:19 opengl的鼠标画线,圆,矩形,还有个菜单,很适合opengl初学者学习\interGraphics\interGraphics\interGraphics.vcproj.HP-B23A3C94F490.hp.user
文件 732160 2009-10-27 20:19 opengl的鼠标画线,圆,矩形,还有个菜单,很适合opengl初学者学习\interGraphics\interGraphics.ncb
文件 905 2009-10-26 18:02 opengl的鼠标画线,圆,矩形,还有个菜单,很适合opengl初学者学习\interGraphics\interGraphics.sln
..A..H. 13312 2009-10-27 20:19 opengl的鼠标画线,圆,矩形,还有个菜单,很适合opengl初学者学习\interGraphics\interGraphics.suo
目录 0 2009-10-27 19:44 opengl的鼠标画线,圆,矩形,还有个菜单,很适合opengl初学者学习\interGraphics\interGraphics\Debug
目录 0 2009-10-27 19:44 opengl的鼠标画线,圆,矩形,还有个菜单,很适合opengl初学者学习\interGraphics\Debug
目录 0 2009-10-27 19:44 opengl的鼠标画线,圆,矩形,还有个菜单,很适合opengl初学者学习\interGraphics\interGraphics
目录 0 2009-10-26 18:03 opengl的鼠标画线,圆,矩形,还有个菜单,很适合opengl初学者学习\interGraphics
目录 0 2018-11-30 05:27 opengl的鼠标画线,圆,矩形,还有个菜单,很适合opengl初学者学习
----------- --------- ---------- ----- ----
1702979 22
相关资源
- OpenGL参考手册
- mfc单文档窗体画线与写字
- Qt Creator opengl实现四元数鼠标控制轨迹
- OpenGL文档,api大全,可直接查询函数
- opengl轮廓字体源代码
- MFC读三维模型obj文件
- 利用OpenGL写毛笔字算法
- MFC中OpenGL面和体的绘制以及动画效果
- 基于OPENGL的光线跟踪源代码368758
- VC 实现三维旋转(源码)
- 自编用openGL实现3D分形树,分形山
- OpenGL球形贴图自旋程序
- OpenGL导入贴图的Texture类
- 计算机图形学(openGL)代码
- 用OpenGL开发的机械臂运动仿真程序(
- OpenGL-3D坦克模拟
- OPENGL实现世界上最小的3D游戏
- VS2012OpenGL配置所需要的全部libdllh文件
- 简化三心圆拱巷道施工开挖轮廓线的
- 基于OpenGL的仿蝗虫机器人三维动态仿
- 图形学 - OpenGL实现3种三维茶壶显示源
- opengl程序-会跳舞的骷髅
- opengl实现三维网格光顺Laplacian算法
- opengl——爆炸
- OpenGL三维地形建模
- opengl游戏编程徐明亮版(含源码)
- 用OPENGL画的一个简单的直升飞机
- opengl完美天空盒
- 3D绘图程序设计:使用Direct3D 10/9和Ope
- OpenGL绘制可运动自行车源程序.zip
评论
共有 条评论