add control mode

This commit is contained in:
2025-03-03 01:15:52 +08:00
parent 9423357502
commit d60c16028e
144 changed files with 25 additions and 9 deletions

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

@@ -1,11 +1,13 @@
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(1091,5): warning MSB8027: 名为 openGLMatrix.cpp 的两个或更多文件将生成到同一位置的输出。这会导致错误的生成结果。 调用的文件是 ..\openGLHelper\openGLMatrix.cpp, openGL\openGLMatrix.cpp。
hw1.cpp
C:\Project\opengl\assignment\hw1\hw1.cpp(310,27): warning C4244: “参数”: 从“float”转换到“unsigned int”可能丢失数据
C:\Project\opengl\assignment\hw1\hw1.cpp(354,51): warning C4305: “初始化”: 从“int”到“float”截断
C:\Project\opengl\assignment\hw1\hw1.cpp(504,16): warning C4244: “初始化”: 从“int”转换到“float”可能丢失数据
C:\Project\opengl\assignment\hw1\hw1.cpp(668,23): warning C4018: “<”: 有符号/无符号不匹配
C:\Project\opengl\assignment\hw1\hw1.cpp(670,27): warning C4018: “<”: 有符号/无符号不匹配
C:\Project\opengl\assignment\hw1\hw1.cpp(718,25): warning C4244: “参数”: 从“float”转换到“unsigned int”可能丢失数据
C:\Project\opengl\assignment\hw1\hw1.cpp(324,27): warning C4244: “参数”: 从“float”转换到“unsigned int”可能丢失数据
C:\Project\opengl\assignment\hw1\hw1.cpp(368,51): warning C4305: “初始化”: 从“int”到“float”截断
C:\Project\opengl\assignment\hw1\hw1.cpp(518,16): warning C4244: “初始化”: 从“int”转换到“float”可能丢失数据
C:\Project\opengl\assignment\hw1\hw1.cpp(682,23): warning C4018: “<”: 有符号/无符号不匹配
C:\Project\opengl\assignment\hw1\hw1.cpp(684,27): warning C4018: “<”: 有符号/无符号不匹配
C:\Project\opengl\assignment\hw1\hw1.cpp(732,25): warning C4244: “参数”: 从“float”转换到“unsigned int”可能丢失数据
shader.cpp
正在生成代码...
C:\Project\opengl\assignment\hw1\\Bin\Debug\openGLMatrix.obj : warning LNK4042: 对象被多次指定;已忽略多余的指定
jpeg.lib(jerror.obj) : 找到 MSIL .netmodule 或使用 /GL 编译的模块;正在使用 /LTCG 重新启动链接;将 /LTCG 添加到链接命令行以改进链接器性能
LINK : warning LNK4075: 忽略“/INCREMENTAL”(由于“/LTCG”规范)

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

@@ -32,7 +32,7 @@ using namespace std;
// Width and height of the OpenGL window, in pixels.
int windowWidth = 1280;
int windowHeight = 720;
char windowTitle[512] = "CSCI 420 Homework 1";
char windowTitle[512] = "三角形渲染(键 3)";
int terrainWidth = 0;
int terrainHeight = 0;
// Stores the image loaded from disk.
@@ -46,7 +46,7 @@ unsigned int* indices;
int position_count, color_count,index_count;
terran::mouse_button_state mouseButtonState = { 0, 0, 0 };
int controlMode = 0;
OpenGLMatrix matrix;
VBO *vboVertices = nullptr;
VBO *vboColors = nullptr;
@@ -152,6 +152,9 @@ void reshapeFunc(int w, int h)
void mouseMotionDragFunc(int x, int y)
{
if (controlMode == 0) {
return;
}
int mousePosDelta[2] = { x - mousePos[0], y - mousePos[1] };
switch (controlState) {
case terran::TRANSLATE:
@@ -192,8 +195,11 @@ void mouseMotionDragFunc(int x, int y)
break;
}
// store the new mouse position
mousePos[0] = x;
mousePos[1] = y;
}
void mouseMotionFunc(int x, int y)
@@ -255,6 +261,8 @@ void keyboardFunc(unsigned char key, int x, int y)
switch_mode(terran::displayMode::points);
std::cout << "mode switch to points display." << std::endl;
mode = terran::displayMode::points;
glutSetWindowTitle("点渲染(键 1)");
controlMode = 0;
}
break;
case '2':
@@ -262,6 +270,8 @@ void keyboardFunc(unsigned char key, int x, int y)
switch_mode(terran::displayMode::lines);
std::cout << "mode switch to lines display." << std::endl;
mode = terran::displayMode::lines;
glutSetWindowTitle("线渲染(键 2)");
controlMode = 0;
}
break;
case '3':
@@ -269,6 +279,8 @@ void keyboardFunc(unsigned char key, int x, int y)
switch_mode(terran::displayMode::triangles);
std::cout << "mode switch to triangles display." << std::endl;
mode = terran::displayMode::triangles;
glutSetWindowTitle("三角形渲染(键 3)");
controlMode = 0;
}
break;
case '4':
@@ -276,6 +288,8 @@ void keyboardFunc(unsigned char key, int x, int y)
switch_mode(terran::displayMode::smoothTriangles);
std::cout << "mode switch to smoothTriangles display." << std::endl;
mode = terran::displayMode::smoothTriangles;
glutSetWindowTitle("优化渲染(键 4)");
controlMode = 1;
}
break;
@@ -305,7 +319,7 @@ void timerFunc(int t)
strcat(path, number);
strcat(path, ".jpg");
frame_save_count++;
saveScreenshot(path);
//saveScreenshot(path);
}
glutTimerFunc(1000.0f / (float)FPS, timerFunc, 0);
}

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 191 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 191 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 191 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 191 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 191 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 191 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 191 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 191 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 191 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 191 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 191 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

Some files were not shown because too many files have changed in this diff Show More