Anonymous
Ошибка шейдера OpenGL, вызывающая невидимый треугольник
Сообщение
Anonymous » 29 ноя 2024, 09:44
Я использую OpenGL с glew и glfw. Я создал два шейдера, и они нормально компилируются, но треугольник не отображается.
Код: Выделить всё
//I apologise for the weird code most of it is from the chernos tutorials
#include
#ifdef _WIN64
std::string current_os = "Windows";
#endif
#ifdef __APPLE__
std::string current_os = "OSX";
#endif
#ifdef __linux__
std::string current_os "Pigwin"
#endif
#include
#include
#include
template
os_swich os_depen(os_swich func, std::string osneeded){
if (current_os == osneeded){
func;
}
return 0;
}
static unsigned int CompileShader( unsigned int type, const std::string source){
unsigned int id = glCreateShader(type);
const char* src = source.c_str();
glShaderSource(id, 1, &src, nullptr);
glCompileShader(id);
int result;
glGetShaderiv(id, GL_COMPILE_STATUS, &result);
if (result == GL_FALSE){
int length;
glGetShaderiv(id, GL_INFO_LOG_LENGTH, &length);
char* message = (char*)alloca(length * sizeof(char));
glGetShaderInfoLog(id, length, &length, message);
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79236064/opengl-shader-error-causing-an-invisible-triangle[/url]
1732862666
Anonymous
Я использую OpenGL с glew и glfw. Я создал два шейдера, и они нормально компилируются, но треугольник не отображается. [code]//I apologise for the weird code most of it is from the chernos tutorials #include #ifdef _WIN64 std::string current_os = "Windows"; #endif #ifdef __APPLE__ std::string current_os = "OSX"; #endif #ifdef __linux__ std::string current_os "Pigwin" #endif #include #include #include template os_swich os_depen(os_swich func, std::string osneeded){ if (current_os == osneeded){ func; } return 0; } static unsigned int CompileShader( unsigned int type, const std::string source){ unsigned int id = glCreateShader(type); const char* src = source.c_str(); glShaderSource(id, 1, &src, nullptr); glCompileShader(id); int result; glGetShaderiv(id, GL_COMPILE_STATUS, &result); if (result == GL_FALSE){ int length; glGetShaderiv(id, GL_INFO_LOG_LENGTH, &length); char* message = (char*)alloca(length * sizeof(char)); glGetShaderInfoLog(id, length, &length, message); std::cout Подробнее здесь: [url]https://stackoverflow.com/questions/79236064/opengl-shader-error-causing-an-invisible-triangle[/url]