gpt4 book ai didi

c++ - glScaled(size/window_size) 不正确的图像

转载 作者:太空宇宙 更新时间:2023-11-04 12:55:24 24 4
gpt4 key购买 nike

<分区>

当我使用 glScale(size/window_size) 绘制四面体 (window_size = 600x600) 并且输入 size = 600 时,它绘制的图片不正确

[ Output 1 .

当我输入 size < 600 时它不绘制任何东西,直到 1200 它绘制与给定的较低图像相同的图像,在 1200 之后再次不绘制任何东西。怎么做正确?

int size_cat;
std::cin >> size_cat;
screen = SDL_CreateWindow("Jack.exe", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 600, 600, SDL_WINDOW_OPENGL);

int size_h = 2 * size_cat;

SDL_GLContext context = SDL_GL_CreateContext(screen);
glClearColor(0, 0, 0, 1);
glRotatef(25, 1, 1, 0);
while (1)
{
SDL_Event event;
while (SDL_PollEvent(&event))
{
switch (event.type)
{
case SDL_QUIT:
return 0;
case SDL_KEYDOWN:
if (event.key.repeat) break;
switch (event.key.keysym.scancode)
{
case SDL_SCANCODE_1: glColor3b(127, 0, 0); break;
case SDL_SCANCODE_2: glColor3b(0, 127, 0); break;
case SDL_SCANCODE_3: glColor3b(0, 0, 127); break;
}
break;
}
}

glClear(GL_COLOR_BUFFER_BIT);

glScalef(size_cat/600, size_cat/600, size_cat/600);

glBegin(GL_LINES);

glVertex3f(0.5, 1, -0.5);
glVertex3f(0.5, 0, -0.5);

glVertex3f(0.5, 0 ,-0.5);
glVertex3f(0.5, 0, 0.5);

glVertex3f(0.5, 0, 0.5);
glVertex3f(-0.5, 0, -0.5);

glVertex3f(-0.5, 0, -0.5);
glVertex3f(0.5, 0, -0.5);

glVertex3f(0.5, 1, -0.5);
glVertex3f(0.5, 0, 0.5);

glVertex3f(0.5, 1, -0.5);
glVertex3f(-0.5, 0, -0.5);

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com