小编Dia*_*ame的帖子

gluLook在绘制形状后无法正常工作

我真的很困惑如何gluLookAtglOrthogluPersective一起工作.这是问题所在.

我在-5轴的z轴上绘制了一个2D三角形和一个2D五边形.

//pentagon
glVertex3f(0.5f, 0.5f, -5.0f);
glVertex3f(1.5f, 0.5f, -5.0f);
glVertex3f(0.5f, 1.0f, -5.0f);

glVertex3f(0.5f, 1.0f, -5.0f);
glVertex3f(1.5f, 0.5f, -5.0f);
glVertex3f(1.5f, 1.0f, -5.0f);

glVertex3f(0.5f, 1.0f, -5.0f);
glVertex3f(1.5f, 1.0f, -5.0f);
glVertex3f(1.0f, 1.5f, -5.0f);

//Triangle
glVertex3f(-0.5f, 0.5f, -5.0f);
glVertex3f(-1.0f, 1.5f, -5.0f);
glVertex3f(-1.5f, 0.5f, -5.0f);
Run Code Online (Sandbox Code Playgroud)

然后我定义我的相机位置(0,0,-10)和透视

//Tell OpenGL how to convert from coordinates to pixel values
glViewport(0, 0, w, h);
gluLookAt(0, 0, -10, 0, 0, -200, 0, 1, 0);
glMatrixMode(GL_PROJECTION); //Switch to setting the camera perspective

//Set the camera …
Run Code Online (Sandbox Code Playgroud)

c++ opengl

0
推荐指数
1
解决办法
387
查看次数

为什么uint64_t无法正常显示pow(2,64) - 1?

我试图理解为什么uint64_t类型无法正常显示pow(2,64)-1 .cplusplus标准是199711L.

我检查了pow()C++ 98标准下的函数

double pow (double base     , double exponent);
float pow (float base      , float exponent);
long double pow (long double base, long double exponent);
double pow (double base     , int exponent);
long double pow (long double base, int exponent);
Run Code Online (Sandbox Code Playgroud)

所以我写了下面的代码片段

double max1 = (pow(2, 64) - 1);
cout << max1 << endl;

uint64_t max2 = (pow(2, 64) - 1);
cout << max2 << endl;

uint64_t max3 = -1;
cout << max3 << …
Run Code Online (Sandbox Code Playgroud)

c++ floating-point double uint64

-1
推荐指数
1
解决办法
186
查看次数

标签 统计

c++ ×2

double ×1

floating-point ×1

opengl ×1

uint64 ×1