Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29065 Discussions

F03GL: How to use OpenGL extension functions such as glActiveTextureARB and glMultiTexCoord3fARB

nightcat
Novice
4,329 Views

I want to realize the 3D 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. 

I tried to test thunderbirdgl.f90 and thunderbirdvbo.f90 from bluebook of f03gl_trunk-r76 download from https://code.launchpad.net/~hwkrus/f03gl/trunk, the F03GL library from  https://www-stone.ch.cam.ac.uk/pub/f03gl/index.xhtml includes all objs from the sources codes of OpenGL_gl.f90, OpenGL_glu.f90, OpenGL_glut.f90, OpenGL_freeglut.f90,gltools.f90, math3d.f90 and glut_fonts.c, and opengl32.lib, glut32.lib, glut64.lib (freeglut.lib), glew32.lib, glew32s.lib. However, I always encounter the same type fatal errors of "error LNK2019: unresolved external symbol_ glActiveTextureARB, ..." when I do this like:compile and link command in x64 CMD:

>ifort /Qm64 thunderbirdgl.f90 gltools.obj gltools_c.obj math3d.obj opengl_gl.obj opengl_glu.obj opengl_glut.obj glut_fonts.obj opengl32.lib glut64.lib glew32.lib glew32s.lib

(All these objs and libs are in the same directory as thunderbirdgl.f90 is.)

After exexuting the above command, the 2 messages of error LNK2019 are shown in CMD window, such as:

thunderbirdgl.obj : error LNK2019: unresolved external symbol _ glActiveTextureARB referenced in function _SETUPRC

thunderbirdgl.obj : error LNK2019: unresolved external symbol _glMultiTexCoord3fARB referenced in function _renderscene 

For thunderbirdvbo.f90, there are the same error messages. 

I note that these OpenGL extension functions have been defined in opengl_gl.f90. 

Now I don't know how to solve this problem.  Can any experienced expert or specialist help me about this?

Many thanks in advance!

20 Replies
nightcat
Novice
4,280 Views

Can Nobody not help me for this question?

0 Kudos
nightcat
Novice
4,279 Views

Can nobody help me for this question?

Thanks

0 Kudos
JohnNichols
Valued Contributor III
4,240 Views

@nightcat , a zero response usually means that people do not have the time to waste to solve this problem, usually because you have not made it easy enough or the problem is outside the interest of the Intel Fortran people. 

If you want my help, you need to set the whole problem up as a Visual Studio Solution using the latest VS 2022 but the not the preview and run it with oneapi to show the errors

Zip the solution file and all the folders into a zip file and upload it, with the errors.  Tell us your computer type and the Windows version.  

It is then a few minutes work for someone to look at the problem, your request asks too much at the moment.  

John

0 Kudos
jimdempseyatthecove
Honored Contributor III
4,239 Views

I suggest you do some google searching for  glActiveTextureARB and glMultiTexCoord3fARB

For example, first hit: https://stackoverflow.com/questions/66047217/glactivetexture-or-glactivetexturearb

indicates a version issue of when the function was incorporated into the OpenGL library.

So this looks like you may need to either update .OR. retro-date your OpenGL library to one containing the library functions your application requires.

 

Jim Dempsey

0 Kudos
andrew_4619
Honored Contributor III
4,138 Views

The ARB extensions are hardware implementation dependant so are not part of the standard OGL library. You need to use these via an extension wrangler that interrogates the hardware and finds if a particular feature is supported by the graphics system. You then can get procedure pointers so you can call it dynamically. The routines typically will be in DLL device drivers. I am not an expert on this and cannot really guide you and further on that.  

0 Kudos
andrew_4619
Honored Contributor III
4,124 Views

Actually with the function you used what I said is not 100% correct. Those functions are in the ogl lib but you need to get a procedure pointer using "wglGetProcAdresss" because the functions are not exported.

The code below does get a non-zero integer pointer  for glActiveTextureARB so it 'works' but you would  need an interface for that and a procedure pointer to that interface and then associate that procedure pointer with the integer pointer using C_F_PROCPOINTER.

 

 

    call test_wglGetProcAddress( 'glActiveTextureARB'//achar(0) )

    subroutine test_wglGetProcAddress( gname )
        use myfwin, only: handle
        use, intrinsic :: ISO_C_BINDING, only: C_PTR, C_LOC
        character(*), intent(in), target :: gname  !must be null terminated
        type(C_PTR) :: cp
        integer(handle) :: iptr, ifunptr
        interface
             function wglGetProcAddress( param1 ) BIND(C,NAME="wglGetProcAddress")
                import
                !DIR$ ATTRIBUTES STDCALL :: wglGetProcAddress
                !GCC$ ATTRIBUTES STDCALL :: wglGetProcAddress
                integer(handle) :: wglGetProcAddress
                integer(handle), value :: param1
             end function wglGetProcAddress
        end interface
        cp = C_LOC( gname )
        iptr = transfer(cp, iptr )
        ifunptr = wglGetProcAddress( iptr )
    end subroutine test_wglGetProcAddress

 

 

 

nightcat
Novice
4,059 Views

Firstly many thanks all replies on my question, and specially think Andrew for his suggestions.

For Andrew’s suggestion, I don’t have the module ‘myfwin’, and so could not test the function of ‘call test_wglGetProcAddress( 'glActiveTextureARB'//achar(0) )’.

Here I give the environment configuration of compiling and linking for the sample program, thunderbirdgl.f90, and all libs and obj and related mod files, as well as the original f90 and cpp files in WinRAR format:

spheremod.mod

gltools_c.obj

gltools_c.cpp

gltools.obj

glframes.mod

ctrianglemeshes.mod

vbomeshes.mod

opengl_glext.mod

opengl_glee.mod

gltools.f90

math3d.obj

math3d.f90

opengl_freeglut.obj

opengl_glut.mod

opengl_glut.obj

opengl_glu.obj

opengl_glu.mod

opengl_gl.obj

opengl_gl.mod

opengl_kinds.mod

freeglut.dll

freeglut.lib

glew32.dll

glew32.lib

glew32s.lib

GlU32.Lib

glut32.dll

glut32.lib

glut32-lib

glut64.dll

glut64.lib

OpenGL32.Lib

OpenGL_freeglut.f90

OpenGL_gl.f90

OpenGL_glu.f90

OpenGL_glut.f90

MultiTextures_ARB.cpp

 

Compiling and linking environments: Win11x64 + VS2022 Intel oneAPI 2023 Fortran + 2023 DPC++/C++and using “Intel oneAPI command prompt for Intel 64 for Visual Studio 2022” CMD.

Enter the following command on the 64-bit CMD:

>ifort /Qm64 thunderbirdgl.f90 gltools.obj math3d.obj gltools_c.obj opengl_gl.obj opengl_glu.obj opengl_glut.obj opengl32.lib glu32.lib glut32.lib glew32.lib glew32s.lib

As press Enter key, then, CMD window screen appears:

 

F:\OpenGLIncludeLibs\f03glLibExamples\f03gl_trunk-r76\bluebook>ifort /Qm64 thunderbirdgl.f90 gltools.obj math3d.obj gltools_c.obj opengl_gl.obj opengl_glu.obj opengl_glut.obj opengl32.lib glu32.lib glut32.lib glew32.lib glew32s.lib

Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.8.0 Build 20221119_000000

Copyright (C) 1985-2022 Intel Corporation.  All rights reserved.

 

Microsoft (R) Incremental Linker Version 14.35.32215.0

Copyright (C) Microsoft Corporation.  All rights reserved.

 

-out:thunderbirdgl.exe

-subsystem:console

thunderbirdgl.obj

gltools.obj

math3d.obj

gltools_c.obj

opengl_gl.obj

opengl_glu.obj

opengl_glut.obj

opengl32.lib

glu32.lib

glut32.lib

glew32.lib

glew32s.lib

thunderbirdgl.obj : error LNK2019: unresolved external symbol _ glActiveTextureARB referenced in function _SETUPRC

thunderbirdgl.obj : error LNK2019: unresolved external symbol _glMultiTexCoord3fARB referenced in function _renderscene 

thunderbirdgl.exe : fatal error LNK1120: 2 unresolved external commands

 

F:\OpenGLIncludeLibs\f03glLibExamples\f03gl_trunk-r76\bluebook>

 

For thunderbirdvbo.f90, there are the same error messages.

I note that these OpenGL extension functions have been defined in opengl_gl.f90.

 

In fact, I have successfully compiled and linked 44 of the 46 example programs in the bluebook directory. Only the two example programs, thunderbirdgl.f90 and thunderbirdvbo.f90, cannot be linked successfully, and the problem is stuck in the subroutine functions of the glActiveTextureARB and glMultiTexCoord3fARB of OpenGL extension functions.

In addition, on my current machine, a C++ sample program using two OpenGL extentsion subroutine functions, glActiveTextureARB and glMultiTexCoord3fARB, MultiTextures_ARB.cpp, can simply compile and link successfully using the following command on the 64-bit console command line of Win11x64 + VS2022 Intel oneAPI 2023 DPC++/C++ for compiling and linking:

>icx /Qm64 MultiTextures_ARB.cpp opengl32.lib glu32.lib freeglut.lib

 

Now I don't know how to solve this problem:

thunderbirdgl.obj : error LNK2019: unresolved external symbol _ glActiveTextureARB referenced in function _SETUPRC

thunderbirdgl.obj : error LNK2019: unresolved external symbol _glMultiTexCoord3fARB referenced in function _renderscene 

 

Can any experienced expert or specialist help me about this?

Thank you very much for your help!

0 Kudos
andrew_4619
Honored Contributor III
4,050 Views

Well myfwin is my personal windows SDK types module but you can use  the intel provided ifwin module.

The problem is that a long time ago Opengl stopped adding new routines because there was an explosion of hardware dependant  functionality. The routines you are trying have interfaces in the OpenGl definitions but they may or may not  have an implementation on your specific machine. They supply  the wglGetProcAddress routine that you use to test if the routine exists and it gives you a pointer to the function in the lib. You cannot direct link. For the last many years the OpenGL standard has not included any new functions  at all they are all dynamically inquired and that is whey other software is used to manage loading them e.g. GLEW  

 

    subroutine test_wglGetProcAddress()
        use myfwin, only: handle
        use OpenGL_gl, only: glActiveTextureARB, GL_TEXTURE0_ARB
        use, intrinsic :: ISO_C_BINDING, only: C_F_PROCPOINTER, C_NULL_FUNPTR
        integer(handle) :: ifunptr
        procedure(glActiveTextureARB), pointer :: pGlActiveTextureARB => null()
        ifunptr = my_wglGetProcAddress( 'glActiveTextureARB'//achar(0) )
        if ( ifunptr /= 0 ) call C_F_PROCPOINTER( TRANSFER( ifunptr, C_NULL_FUNPTR ), pGlActiveTextureARB )
        if( associated(pGlActiveTextureARB) ) call pGlActiveTextureARB( GL_TEXTURE0_ARB )  ! seems to work
    end subroutine test_wglGetProcAddress

 You will note in the example above that pGlActiveTextureARB is a pointer to a function that has the interface GlActiveTextureARB and that at line 9 if it succeeded in finding the routine it calls it using the procedure pointer. I tested this code and it works on my system. 

0 Kudos
nightcat
Novice
4,037 Views

andrew:

Thank you  very much.

I'll try this according to your suggestion.

By the way, do you have any sample f03gl program using glActiveTextureARB and glMultiTexCoord3fARB subroutine functions through compiling and linking?

Thanks once again.

0 Kudos
andrew_4619
Honored Contributor III
4,022 Views

where is you get opengl_glext.mod and opengl_glee.mod?

Did you compile some source for those? I note that the thunderbird example calls up the glee module. If that is working correctly it should  wrangle the extensions for you. I had a look on the links you quoted but didn't find a fortran/glee interface.

 

In general though what you are trying to do is not so easy in fortran.

 

 

 

 

0 Kudos
nightcat
Novice
4,009 Views

This opengl_glext.mod, opengl_glee.mod are automatically generated by compiling gltools.f90 which is from bluebook. (I am only to add some subroutine functions into gltools.f90)

The glActiveTextureARB and glMultiTexCoord3fARB subroutine functions are not used in sample program thunderbird.f90, but only in  thunderbirdgl.f90 and thunderbirdgl.f90.

I can corrrectly compile and link thunderbird.f90 and run thunderbird.exe (64 bit) normally, but the linking alway fails for thunderbirdgl.f90 and thunderbirdgl.f90 because of

thunderbirdgl.obj : error LNK2019: unresolved external symbol _ glActiveTextureARB referenced in function _SETUPRC

thunderbirdgl.obj : error LNK2019: unresolved external symbol _glMultiTexCoord3fARB referenced in function _renderscene

I note the definition for glActiveTextureARB and glMultiTexCoord3fARB in gl.h, and transformation in opengl_gl.f90:

! ActiveTextureARB(texture)
! return void
! param texture TextureUnit in value
SUBROUTINE glActiveTextureARB(texture) BIND(C,NAME="glActiveTextureARB")
        IMPORT
        INTEGER(GLenum), VALUE :: texture
END SUBROUTINE glActiveTextureARB

! MultiTexCoord3fARB(target, s, t, r)
! return void
! param target TextureUnit in value
! param s CoordF in value
! param t CoordF in value
! param r CoordF in value
SUBROUTINE glMultiTexCoord3fARB(target, s, t, r) &
                BIND(C,NAME="glMultiTexCoord3fARB")
        IMPORT
        INTEGER(GLenum), VALUE :: target
        REAL(GLfloat), VALUE :: s, t, r
END SUBROUTINE glMultiTexCoord3fARB

but why does linking fail, and what happens?

0 Kudos
nightcat
Novice
4,009 Views

By the way, last time you give me a subroutine:

subroutine test_wglGetProcAddress() use myfwin, only: handle use OpenGL_gl, only: glActiveTextureARB, GL_TEXTURE0_ARB use, intrinsic :: ISO_C_BINDING, only: C_F_PROCPOINTER, C_NULL_FUNPTR integer(handle) :: ifunptr procedure(glActiveTextureARB), pointer :: pGlActiveTextureARB => null() ifunptr = my_wglGetProcAddress( 'glActiveTextureARB'//achar(0) ) if ( ifunptr /= 0 ) call C_F_PROCPOINTER( TRANSFER( ifunptr, C_NULL_FUNPTR ), pGlActiveTextureARB ) if( associated(pGlActiveTextureARB) ) call pGlActiveTextureARB( GL_TEXTURE0_ARB ) ! seems to work end subroutine test_wglGetProcAddress

 

Where is the function 'my_wglGetProcAddress( )' from?

 

 

0 Kudos
andrew_4619
Honored Contributor III
3,996 Views

OK I see I did not post my_wglGetProcAddress which was just a wrapper from the opengl function wglGetProc...

See below. I added the interface to that to my opengl module. I will look at gltools that seems interesting it must parse the c headers...

 

 

    function my_wglGetProcAddress( gname ) result( ifunptr )
        use myfwin, only: handle
        use OpenGL_GL, only: wglGetProcAddress
        use, intrinsic :: ISO_C_BINDING, only: C_PTR, C_LOC
        integer(handle) :: ifunptr
        character(*), intent(in), target :: gname  !must be null terminated
        type(C_PTR) :: cp
        integer(handle) :: iptr
        cp = C_LOC( gname )
        iptr = transfer(cp, iptr )
        ifunptr = wglGetProcAddress( iptr ) 
    end function my_wglGetProcAddress
    subroutine test_wglGetProcAddress()
        use myfwin, only: handle
        use OpenGL_gl, only: glActiveTextureARB, GL_TEXTURE0_ARB
        use, intrinsic :: ISO_C_BINDING, only: C_F_PROCPOINTER, C_NULL_FUNPTR
        integer(handle) :: ifunptr
        procedure(glActiveTextureARB), pointer :: pGlActiveTextureARB => null()
        ifunptr = my_wglGetProcAddress( 'glActiveTextureARB'//achar(0) )
        if ( ifunptr /= 0 ) call C_F_PROCPOINTER( TRANSFER( ifunptr, C_NULL_FUNPTR ), pGlActiveTextureARB )
        if( associated(pGlActiveTextureARB) ) call pGlActiveTextureARB( GL_TEXTURE0_ARB )  ! seems to work
    end subroutine test_wglGetProcAddress

 

 

0 Kudos
andrew_4619
Honored Contributor III
3,990 Views

OK gltools.f90 is not so interesting, it has some very limited (incomplete) sub-set modules opengl_glee and opengl_glext where a few parameters and interfaces that were needed for some data example were added. Disappointing.

You need to understand that on Windows OpenGL has libraries opengl32.lib and opengl32.dll. In all cases the routines are actually in the dll. The older routines that have interfaces in F03GL have stubs defined in opengl32.lib that you can link to then these automatically resolve dynamically to routines in the dll at run time. There are a few interfaces in F03GL that are older extensions that you enquire using wglGetProcAddress which if successful gives you a function pointer to so you can call that routine which again dynamically links to the dll. The two missing functions we are discussing fall into this category. You can load them using the code example I supplied. It is unclear what is missing from your example that would have made it link ok but it is some code loader for those functions.


All the newer extensions need to be provided by an extension loader. GLEE is an extension loader but it does not seem to be implemented in the example you quoted. I suggest you read https://www.khronos.org/opengl/wiki/Load_OpenGL_Functions

Regards
Andrew

0 Kudos
nightcat
Novice
3,979 Views

Dear Andrew,

Thanks for your suggestion.

When I tested your codes above, CMD window displayed the following error messages:

F:\OpenGLIncludeLibs\f03glLibExamples\f03gl_trunk-r76-0\VBO>ifort /Qm64 thunderbirdgl.f90 glew_wrapper.obj glew_wrapper_c.obj gltools_math3d.obj opengl_gl.obj opengl_glu.obj opengl_glut.obj opengl32.lib glu32.lib glut32.lib glew32.lib glew32s.lib
Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.8.0 Build 20221119_000000
Copyright (C) 1985-2022 Intel Corporation. All rights reserved.

thunderbirdgl.f90(176): error #8064: This syntax is invalid; the keyword C is required when using the BIND attribute. [IFUNPTR]
subroutine my_wglGetProcAddress( gname ) result( ifunptr )
-------------------------------------------------^
thunderbirdgl.f90(178): error #6580: Name in only-list does not exist or is not accessible. [WGLGETPROCADDRESS]
use OpenGL_GL, only: wglGetProcAddress
-----------------------------^
compilation aborted for thunderbirdgl.f90 (code 1)

 

But the key is how your codes is be directly related the glActiveTextureARB and glMultiTexCoord3fARB of OpenGL extension functions in thunderbirdgl.f90.

By the way, I also looked at the web address https://www.khronos.org/opengl/wiki/Load_OpenGL_Functions, and found that a C++ OpenGL extension function sample program MultiTextures_ARB.cpp given in the above compressed package bluebook.rar is the realization of the Load OpenGL Functions. But I don't know how to do this in F03GL sample thunderbirdgl.f90.

 

Thanks again.

 

Regards

MX

0 Kudos
nightcat
Novice
3,979 Views

Moreover, the code ' use OpenGL_GL, only: wglGetProcAddress' doesn't seem to be defined in OpenGL_GL.f90.

0 Kudos
andrew_4619
Honored Contributor III
3,960 Views

Indeed it isn't in the published OpenGL_GL,  it  is missing. The interface is stated in code earlier in this thread. 

0 Kudos
nightcat
Novice
3,934 Views

Dear Andrew,

I wrote a small test program according to your subroutines and functions above, and made a testing. The source code is as follows: 

program TestwglGetProcAddress
    use ifwin
    use opengl_gl
    use opengl_glut
 
    integer(handle) :: iptr0
 
    call glutInit
    call glutInitDisplayMode(ior(GLUT_DOUBLE, &
                        ior(GLUT_RGB,ior(GLUT_DEPTH,GLUT_MULTISAMPLE))))
    call glutInitWindowSize(800, 600)
    iwin = glutCreateWindow('OpenGL F-16 Thunderbird'//char(0))
 
    iptr0 = my_wglGetProcAddress( 'glActiveTextureARB'//achar(0) )
    print*,"iptr0 in Test_wglGetProcAddress=",iptr0,'|'
 
    call test_wglGetProcAddress
 
    call glutMainLoop
 
end program
 
!subroutine my_wglGetProcAddress( gname ) result( ifunptr )
function my_wglGetProcAddress( gname ) result( ifunptr )
    use ifwin, only: handle
    use OpenGL_GL!, only: wglGetProcAddress
    use, intrinsic :: ISO_C_BINDING, only: C_PTR, C_LOC
    integer(handle) :: iptr, ifunptr
 
    character(100), pointer :: Strptr
 
    character(*), intent(in), target :: gname  !must be null terminated
    interface
        function wglGetProcAddress( param1 ) BIND(C,NAME="wglGetProcAddress")
            import
            !DIR$ ATTRIBUTES STDCALL :: wglGetProcAddress
            !GCC$ ATTRIBUTES STDCALL :: wglGetProcAddress
            integer(handle) :: wglGetProcAddress
            integer(handle), value :: param1
        end function wglGetProcAddress
    end interface
    type(C_PTR) :: cp
    cp = C_LOC( gname ) 
 
    print*,'gname=',gname,'|'
    call c_f_pointer(cp, Strptr)
    write(*,*)'Strptr0: ', Strptr(1:index(Strptr,char(0))),'|'
 
    iptr = transfer(cp, iptr )
    ifunptr = wglGetProcAddress( iptr )
 
    write(*,*)"ifunptr0=",ifunptr,'| iptr=',iptr,'|'
 
end function my_wglGetProcAddress
 
subroutine test_wglGetProcAddress()
    use ifwin, only: handle
    use OpenGL_gl, only: glActiveTextureARB, GL_TEXTURE0_ARB
    use, intrinsic :: ISO_C_BINDING, only: C_F_PROCPOINTER, C_NULL_FUNPTR
    integer(handle) :: ifunptr
    procedure(glActiveTextureARB), pointer :: pGlActiveTextureARB => null()
    ifunptr = my_wglGetProcAddress( 'glActiveTextureARB'//achar(0) )
    print*,"ifunptr1=",ifunptr,'|'
 
    if ( ifunptr /= 0 ) call C_F_PROCPOINTER( TRANSFER( ifunptr, C_NULL_FUNPTR ), pGlActiveTextureARB )
    if( associated(pGlActiveTextureARB) ) call pGlActiveTextureARB( GL_TEXTURE0_ARB )  ! seems to work
 
    print*,"end test_wglGetProcAddress"
 
end subroutine test_wglGetProcAddress
 
CMD window outputs:
 
F:\OpenGLIncludeLibs\f03glLibExamples\f03gl_trunk-r76-0\VBO>test_wglGetProcAddress.exe
gname=glActiveTextureARB|
Strptr0: glActiveTextureARB|
ifunptr0= 140706810582128 | iptr= 758327540336 |
iptr0 in Test_wglGetProcAddress= -613002128 |
gname=glActiveTextureARB|
Strptr0: glActiveTextureARB|
ifunptr0= 140706810582128 | iptr= 758327540336 |
ifunptr1= -613002128 |
forrtl: severe (157): Program Exception - access violation
Image PC Routine Line Source
FFFFFFFFDB765470 Unknown Unknown Unknown
test_wglGetProcAd 00007FF6E0CD18C3 Unknown Unknown Unknown
test_wglGetProcAd 00007FF6E0D5090E Unknown Unknown Unknown
test_wglGetProcAd 00007FF6E0D50E00 Unknown Unknown Unknown
KERNEL32.DLL 00007FF9599826BD Unknown Unknown Unknown
ntdll.dll 00007FF959CEDFB8 Unknown Unknown Unknown
 
We can see that the function my_wglGetProcAddress() cannot return a correct integer value (the address of an OpenGL extension function), but ifunptr= 140706810582128 and iptr= 758327540336 from the line ifunptr = wglGetProcAddress( iptr ) in function my_wglGetProcAddress
 
Moreover, the line ' use OpenGL_GL, only: wglGetProcAddress' seems to be invalid.
 
What happens for these?
 
Regards.
MX 
0 Kudos
andrew_4619
Honored Contributor III
3,646 Views

"Moreover, the line ' use OpenGL_GL, only: wglGetProcAddress' seems to be invalid". Well yes in the first example I added the interface to wglGetProcAddress within a routine but by the second example I had moved that interface to the OpenGL_GL module on my computer. This is not that source of your problem,  wglGetProcAddress is in the library it is just that the people that the people that did that F03GL interfaces did not include the specific windows wgl add ons.

 

The fact that wglGetProcAddress returns a non zero value indicted that the GL lib recognises the name of the routine you passed as a pointer to string.  try ifunptr = my_wglGetProcAddress( 'mickymouse'//achar(0) ) and it should treturn zero.  The fact the call crashes maybe because of the gl context . Aslo remember Fortran does not have unsigned integers  so ifunptr1= -613002128  can be a valid address. 

 

 

0 Kudos
pooledoworthy
Beginner
3,651 Views

To use OpenGL extension functions like glActiveTextureARB and glMultiTexCoord3fARB, follow these steps:

Load the Extension: First, you need to load the extension function pointers. This involves retrieving the function addresses using a platform-specific mechanism like wglGetProcAddress for Windows or glXGetProcAddress for Linux. Make sure to check for the availability of the extension before attempting to load its functions.

Declare Function Pointers: Declare function pointers with the appropriate function signatures in your code. For example:

c++
PFNGLACTIVETEXTUREARBPROC glActiveTextureARB;
PFNGLMULTITEXCOORD3FARBPROC glMultiTexCoord3fARB;
Assign Function Pointers: Assign the function pointers by casting the retrieved function addresses to the appropriate function types. For example:

c++
glActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC)wglGetProcAddress("glActiveTextureARB");
glMultiTexCoord3fARB = (PFNGLMULTITEXCOORD3FARBPROC)wglGetProcAddress("glMultiTexCoord3fARB");
Use the Extension Functions: Now, you can use the extension functions in your code as you would use any other OpenGL functions. For example:

c++
glActiveTextureARB(GL_TEXTURE0_ARB);
glMultiTexCoord3fARB(GL_TEXTURE0_ARB, 1.0f, 1.0f, 0.0f);
Ensure that you have a valid OpenGL context active before calling these functions.

0 Kudos
Reply