- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I want to realize the multitexture graph in Intel oneAPI Fortran and VS 2023 by using F03GL (Fortran 2003 Interface to OpenGL) mixed programming of Fortran and C/C++ for my application.
In my program I tried to use OpenGL Multitexture functions such as glActiveTexture(), glMultiTexCoord3f(), glMultiTexCoord2f() which are defined in gl.h but not in OpenGL_gl.f90. So I create a interface to bind C language for these function (just like that in gltools.f90 for the function such as glGenBuffers(), glBindBuffer, and glBufferData()) in my Fortran program:
Interface
! glActiveTexture — select active texture unit
! void glActiveTexture (GLenum texture);
! return void
! param texture TextureUnit in value
SUBROUTINE glActiveTexture (texture) BIND(C, name ="cglewActiveTexture")
IMPORT
INTEGER(kind=GLenum), VALUE :: texture
END SUBROUTINE glActiveTexture
!
! void glClientActiveTexture (GLenum texture);
! return void
! param texture TextureUnit in value
SUBROUTINE glClientActiveTexture (texture) BIND(C, name ="cglewClientActiveTexture ")
IMPORT
INTEGER(kind=GLenum), VALUE :: texture
END SUBROUTINE glClientActiveTexture
!
! void glMultiTexCoord2f (GLenum target, GLfloat s, GLfloat t);
! return void
! param target TextureUnit in value
! param s CoordF in value
! param t CoordF in value
SUBROUTINE glMultiTexCoord2f (target, s, t) BIND(C,NAME="cglewMultiTexCoord2f")
IMPORT
INTEGER(GLenum), VALUE :: target
REAL(GLfloat), VALUE :: s, t
END SUBROUTINE glMultiTexCoord2f
!
! void glMultiTexCoord3f (GLenum target, GLfloat s, GLfloat t, GLfloat r);
! return void
! param target TextureUnit in value
! param s CoordF in value
! param t CoordF in value
! param r CoordF in value
SUBROUTINE glMultiTexCoord3f (target, s, t, r) BIND(C,NAME="cglewMultiTexCoord3f")
IMPORT
INTEGER(GLenum), VALUE :: target
REAL(GLfloat), VALUE :: s, t, r
END SUBROUTINE glMultiTexCoord3f
Interface
I can compile and link my program successfully and create an executable exe file. But when running the exe file and going to any such function, glActiveTexture(), glMultiTexCoord3f(), or glMultiTexCoord2f(), it displays a severe error and immediately exits the application:
forrtl: severe (157): Program Exception - access violation
Image PC Routine Line Source
Now I don't know what happens and how to solve this problem in my Fortran program. Can any experienced expert or specialist help me about this?
Many thanks in advance!
MX
Link Copied

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page