出于某种原因,我尝试在 Fortran 中运行 OpenGL 3.3。我无法调用 glGenBuffers()。尝试使用 glGenBuffers 函数编译程序时,出现 lnk2019 错误。
出于某种原因,我尝试在 Fortran 中运行 OpenGL 3.3。我无法调用 glGenBuffers()
.
尝试使用该 glGenBuffers
函数编译程序时,出现 lnk2019 错误。该 glewInit()
函数返回 0,因此 GLEW 已初始化。这可能与什么有关?
我使用GLFW,尝试了静态GLEW库和动态GLEW库。我编写了该函数的接口如下:
subroutine glGenBuffer(n, buffers) bind(c, NAME = "glGenBuffer")
!DEC$ ATTRIBUTES DLLIMPORT :: glGenBuffers
import :: GLsizei,GLuint, c_ptr
integer(GLsizei) :: n
integer(GLuint) :: buffers
endsubroutine
glewExperimental的描述:
integer(GLboolean), bind(C, name="glewExperimental") :: glewExperimental
代码:
if(glfwInit() .eq. 0) stop -1
call glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR,3)
call glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR,3)
call glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE)
call glfwWindowHint(GLFW_RESIZABLE, 0)
Monitor = glfwGetPrimaryMonitor()
call glfwGetMonitorPhysicalSize(Monitor,mmx,mmy)
GL_contex = glfwCreateWindow(1000, 480, name, C_NULL_PTR, C_NULL_PTR)
if(.not. C_ASSOCIATED(GL_contex)) then
call glfwTerminate()
stop -1
endif
glewExperimental = 1
if(glewInit() .ne. 0) then
print*, 'GLEW eror'
stop -1
endif
call glfwGetFramebufferSize(GL_contex, width, height)
call glGenBuffer(1,VBO)
先感谢您。