【发布时间】:2021-09-18 09:43:08
【问题描述】:
当我尝试通过执行 glGenBuffer() 函数来生成缓冲区时 - 找不到类似的函数。
一些功能仍在工作,从我看到的大部分工作来看,例如以下代码完美运行:
#include <iostream>
#include <GLFW/glfw3.h>
using namespace std;
class Window_Manager
{
public:
GLFWwindow* window;
int Create_Window(int width, int height, const char* title) {
if (!glfwInit()) {
return -1;
}
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_RESIZABLE, GL_TRUE);
glfwWindowHint(GLFW_FOCUSED, GL_TRUE);
window = glfwCreateWindow(width, height, title, NULL, NULL);
if (window == NULL) {
cout << "Failed to create a window! Aborting early..." << endl;
Terminate_Window(window);
return -1;
}
glfwMakeContextCurrent(window);
glViewport(0, 0, width, height);
return 1;
}
void Terminate_Window(GLFWwindow* window) {
glfwSetWindowShouldClose(window, GL_TRUE);
glfwTerminate();
}
};
但这段代码没有:
#include <GLFW/glfw3.h>
#include <Engine_Manager.h>
#include <iostream>
using namespace std;
class Shape2D
{
int VBO;
int Setting_Up(){
VBO = glGenBuffer();
return 1;
}
};
【问题讨论】:
-
你的意思是
glGenBuffers(复数)吗? -
您觉得还有哪些功能没有按预期工作?如果是这样,您可以使用 glGetError
-
您使用的 C# 帮助程序库的
glGenBuffer()是一个在内部使用glGenBuffers()的便利函数。将您对 glGenBuffer() 的调用替换为:glGenBuffers(1, &BVO);并研究该函数的文档。这种情况至少还有几个。 -
除了 GLFW 之外,您可能还必须使用 GLEW。
-
请编辑您的问题以提供可用于重现问题的minimal reproducible example。