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

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

nightcat
Novice
10,109 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!

27 Replies
willamabroy2
Beginner
704 Views

To use OpenGL extension functions like first load them using an extension loader then call them like regular OpenGL functions.

0 Kudos
andrew_4619
Honored Contributor III
682 Views

A strange comment to add to a topic that is two years old, particularly as is a simplistic comment to a subject that had quite extensive discussion.

0 Kudos
Steve_Lionel
Honored Contributor III
666 Views

It's usually indicative of someone who is about to spam the forum.

0 Kudos
andrew_4619
Honored Contributor III
540 Views

I think you are correct Steve! 

0 Kudos
willamabroy2
Beginner
629 Views

Include the OpenGL extension headers, then get function pointers using a loader like GLEW . Once loaded, call and like normal functions.

0 Kudos
joywalim
Beginner
405 Views

 

Include the OpenGL extension headers (like glext.h)  load the functions using a loader (e.g. GLEW or glad)  then call them like this

glActiveTextureARB(GL_TEXTURE0_ARB); glMultiTexCoord3fARB(GL_TEXTURE1_ARB, x, y, z);
 

Make sure your GPU and driver support the extensions.

0 Kudos
qasimdhool
Beginner
391 Views

In F03GL  use use GL and call extension functions like glActiveTextureARB directly if supported. If not  bind them manually using glGetProcAddress.

0 Kudos
Reply