Отображается только черное окно, без каких-либо фигур или чего-либо еще.
Я думаю, что это проблема ОС или устройства, но не знаю, как ее решить.
Я использую Fedora Linux (если это может быть проблемой). Кроме того, в моем ноутбуке нет выделенной видеокарты, только встроенная. Но несколько дней назад на том же устройстве все работало нормально.
Вот мой main.cpp
< pre class="lang-cpp Prettyprint-override">
#define STB_IMAGE_IMPLEMENTATION
#include"stb_image.h"
#include // It links from the driver to the opengl function pointers
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define GLEW_STATIC
struct Vertex{
glm::vec3 position;
glm::vec3 color;
glm::vec2 texcoord;
};
void framebuffer_size_callback(GLFWwindow* window, int width, int height){ // For the resizeability
glViewport(0, 0, width, height);
}
float vertices[] = {
// positions // colors // texture coords
0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top right
0.5f, -0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom right
-0.5f, -0.5f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom left
-0.5f, 0.5f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f // top left
};
unsigned int indices[] = {
0, 1, 2,
0, 2, 3 // second triangle
};
unsigned nofVertices = sizeof(vertices)/sizeof(Vertex); // WIll work here, but if I am sending it to a function and then recienving a pointer then sizeof() will take the size of the pointer and will give errors.
unsigned nofIndices = sizeof(indices)/sizeof(GLuint);
/// Handling Input. This one is currently just closes the window at esc.
void updateInput(GLFWwindow* window){
if(glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS){
glfwSetWindowShouldClose(window, true);
}
}
// Loading shaders:
bool loadshaders(GLuint &program){
bool flag = true;
char infoLog[512];
GLint success;
// glsl ig compiles ie links in runtime.
std::string temp="";
std::string src="";
std::ifstream in_file;
in_file.open("vertex_core.glsl");
if(in_file.is_open()){
while(std::getline(in_file, temp)){
src+=temp+'\n';
}
}
else{
flag=false;
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79306199/opengl-program-is-showing-black-screen-only-while-it-should-be-showing-a-square[/url]
[list] [*]Я использую Fedora Linux для разработки OpenGL. [*]Отображается только черное окно, без каких-либо фигур или чего-либо еще. [*]Я думаю, что это проблема ОС или устройства, но не знаю, как ее решить. Я использую Fedora Linux (если это может быть проблемой). Кроме того, в моем ноутбуке нет выделенной видеокарты, только встроенная. Но несколько дней назад на том же устройстве все работало нормально. [/list] Вот мой main.cpp < pre class="lang-cpp Prettyprint-override">[code]#define STB_IMAGE_IMPLEMENTATION
#include"stb_image.h" #include // It links from the driver to the opengl function pointers #include #include #include #include #include #include #include #include #include #include #include #include #include
void framebuffer_size_callback(GLFWwindow* window, int width, int height){ // For the resizeability glViewport(0, 0, width, height); }
float vertices[] = { // positions // colors // texture coords 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top right 0.5f, -0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom right -0.5f, -0.5f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom left -0.5f, 0.5f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f // top left }; unsigned int indices[] = { 0, 1, 2, 0, 2, 3 // second triangle };
unsigned nofVertices = sizeof(vertices)/sizeof(Vertex); // WIll work here, but if I am sending it to a function and then recienving a pointer then sizeof() will take the size of the pointer and will give errors.
/// Handling Input. This one is currently just closes the window at esc. void updateInput(GLFWwindow* window){ if(glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS){ glfwSetWindowShouldClose(window, true); } }
Я использую Fedora Linux для разработки OpenGL.
Отображается только черное окно, без каких-либо фигур или чего-либо еще.
В моем ноутбуке нет выделенной видеокарты, только встроенная. Но несколько дней назад на том же устройстве все работало...
На экране ничего не отображается.
Отображается только черное окно без каких-либо фигур или чего-либо еще.
У моего ноутбука нет выделенной видеокарты, только встроенная. Но несколько дней назад на том же устройстве все работало нормально.
Текстура не загружается.
Отображается только черное окно, никакой формы или чего-то еще.
Я думаю, что это проблема ОС или устройства, но не знаю, как ее решить.
Я использую Fedora Linux (если это может быть проблемой). Кроме того, в моем ноутбуке...
Недавно моя Fedora (39) работала нормально, каждый раз, когда я загружался, в меню загрузки pc grub появлялось сообщение с вопросом, какой дистрибутив я хочу запустить. Все в порядке.
Затем я создал новый раздел диска и установил в этот раздел новую...
Когда я пытаюсь запустить эмулятор Android (из студии Android или из командной строки), я получаю черный экран.
Общие предложения, которые я нашел и попробовал: p>