-
Anonymous
Второе окно GLFW не отображается?
Сообщение
Anonymous »
Я решил попробовать двойной экран, чтобы отображать квадрат в виде каркаса, а не в цветном квадрате:
Код: Выделить всё
#include
#include
#include
void frameBuffer_size_callback(GLFWwindow* window, int width, int height);
void processInput(GLFWwindow* window, GLFWwindow* secondWindow);
//vertex and fragment shaders
const char* vertexShaderSource = "#version 330 core\n"
"layout (location = 0) in vec3 aPos;\n"
"void main()\n"
"{\n"
" gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);\n"
"}\0";
const char* fragmentShaderSource = "#version 330 core\n"
"out vec4 FragColor;\n"
"void main()\n"
"{\n"
" FragColor = vec4(1.0f, 0.5f, 0.2f, 1.0f);\n"
"}\n";
int success;
char infoLog[512];
int main()
{
//initialization and window hints
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_FLOATING, GLFW_TRUE);
//making the window
GLFWwindow* window = glfwCreateWindow(800, 800, "Square (Wireframe)", NULL, NULL);
//error handling
if (window == NULL) {
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79855063/second-glfw-window-wont-render[/url]
1766934921
Anonymous
Я решил попробовать двойной экран, чтобы отображать квадрат в виде каркаса, а не в цветном квадрате:
[code]#include
#include
#include
void frameBuffer_size_callback(GLFWwindow* window, int width, int height);
void processInput(GLFWwindow* window, GLFWwindow* secondWindow);
//vertex and fragment shaders
const char* vertexShaderSource = "#version 330 core\n"
"layout (location = 0) in vec3 aPos;\n"
"void main()\n"
"{\n"
" gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);\n"
"}\0";
const char* fragmentShaderSource = "#version 330 core\n"
"out vec4 FragColor;\n"
"void main()\n"
"{\n"
" FragColor = vec4(1.0f, 0.5f, 0.2f, 1.0f);\n"
"}\n";
int success;
char infoLog[512];
int main()
{
//initialization and window hints
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_FLOATING, GLFW_TRUE);
//making the window
GLFWwindow* window = glfwCreateWindow(800, 800, "Square (Wireframe)", NULL, NULL);
//error handling
if (window == NULL) {
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79855063/second-glfw-window-wont-render[/url]