gpt4 book ai didi

c++ - OpenGL 两个屏幕

转载 作者:行者123 更新时间:2023-11-28 04:38:58 26 4
gpt4 key购买 nike

<分区>

我的 OpenGL 双屏模式有问题,这意味着当我启动程序时我有一个黑屏,用于错误结束前哨文本和我的 OpenGL 图形。有什么办法可以取消程序运行时的黑屏,只显示图形吗?

我的显示类:

#include <../GL/glew.h>
#include <iostream>
#include "display.h"

bool Display::toClose()
{
return glfwWindowShouldClose(m_window);
}

void Display::pullEvent()
{
glfwPollEvents();
}

Display::Display(int width, int height, const std::string& title)
{
/* Initialize the library */
if (!glfwInit())
error = -1;

m_window = glfwCreateWindow(640, 480, title.c_str(), NULL, NULL);
if(!m_window)
{
glfwTerminate();
error = -1;
}
glfwMakeContextCurrent(m_window);

GLenum res = glewInit();
if(res != GLEW_OK)
{
std::cerr << "Glew failed to initialize!" << std::endl;
}

glEnable(GL_DEPTH_TEST);
}

Display::~Display()
{
glfwDestroyWindow(m_window);
glfwTerminate();
}

void Display::Clear(float r, float g, float b, float a)
{
glClearColor(r, g, b, a);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}

void Display::SwapBuffers()
{
glfwSwapBuffers(m_window);
}

the two screens

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