Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Intel_C_Intel
Employee
100 Views

Is fglrendermode a function or subroutine?

Hi
I am trying to use fglrendermode option. The Opengl book says its a function and the help library says its a function, but the compiler wants it declared as a subroutine. As a function it is supposed to return the number of mouse hits. I am confused as to how this option is to be used. Can someone help me?

Thanks
Kausik
0 Kudos
9 Replies
nijhuis
Beginner
100 Views

fglrendermode is indeed a function but the interface in module Dfopngl is not correct.
I solved it by making a separate module with a function ownfglrendermode in which the interface is stated in the right way.
It looks as follows:

integer*4 function ownfglRenderMode  (mode ) 
!DEC$IF DEFINED(_X86_) 
!DEC$ ATTRIBUTES STDCALL, ALIAS : '_glRenderMode@4' :: fglRenderMode 
!DEC$ELSE 
!DEC$ ATTRIBUTES STDCALL, ALIAS :  'glRenderMode'   :: fglRenderMode 
!DEC$ENDIF 
 
integer*4 mode 
 
  ownfglRenderMode = fglRenderMode(mode) 
 
end function ownfglRenderMode 


I hope this will help you.

Guus Nijhuis
nijhuis
Beginner
100 Views

Sorry for the mess in the first line of the example in the prior message.
Every "!" should start a new line, but I don't know how to get it right.

Guus
Steven_L_Intel1
Employee
100 Views

I'll fix it - the best way to show code is to bracket it in
 ... .

I agree that the declaration in DFOPNGL is wrong. We'll fix DFOPNGL in a future update.

Steve
Intel_C_Intel
Employee
100 Views

Hi
I pasted your fix into dfopngl.f90 and then ran my project by invoking

hits=ownfglrendermode(GL_RENDER)
(where hits is an integer)

But I still get the linker error. Am I missing something?

Thanks
Kausik
Steven_L_Intel1
Employee
100 Views

What is the linker error?

If you are not also using DFOPNGL, you'll want to add opengl32.lib, glaux.lib and glu32.lib to the list of libraries you link against.

Steve
Intel_C_Intel
Employee
100 Views

Hi
I pasted the fix in Dfopngl.f90 just beneath the interface for "fglrendermode" and I ran my project by invoking "ownfglrendermode". But I get the following linker error:

Linking...
xtalmouse.obj : error LNK2001: unresolved external symbol _OWNFGLRENDERMODE@4
Debug/xtaldraw_w.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

Should I make any changes to "dfopngl.mod" or any others in addition to modifying dfopngl.f90?

Thanks
Kausik
Steven_L_Intel1
Employee
100 Views

Don't paste the code in DFOPNGL.F90 - that won't do a thing for you. Put it in your own code, in the routine that calls fglRenderMode.

Steve
Intel_C_Intel
Employee
100 Views

Hi
When I paste the following code in my routine:

interface
integer*4 function ownfglRenderMode (mode )
!DEC$IF DEFINED(_X86_)
!DEC$ ATTRIBUTES STDCALL, ALIAS : '_glRenderMode@4' :: fglRenderMode
!DEC$ELSE
!DEC$ ATTRIBUTES STDCALL, ALIAS : 'glRenderMode' :: fglRenderMode
!DEC$ENDIF
integer*4 mode
ownfglRenderMode = fglRenderMode(mode)
end function ownfglRenderMode
end interface

I get a compiler error :

Error: This statement is invalid in an INTERFACE block.
ownfglRenderMode = fglRenderMode(mode)
^

Can someone help me ?

Thanks
Kausik
Steven_L_Intel1
Employee
100 Views

Oh, I see. I didn't look at Guus' suggestion closely enough.

Use this instead:


interface
integer*4 function ownfglRenderMode  (mode )  
!DEC$IF DEFINED(_X86_)  
!DEC$ ATTRIBUTES STDCALL, ALIAS : '_glRenderMode@4' :: ownfglRenderMode  
!DEC$ELSE  
!DEC$ ATTRIBUTES STDCALL, ALIAS :  'glRenderMode'   :: ownfglRenderMode  
!DEC$ENDIF   
integer*4 mode 
end function ownfglRenderMode  
end interface



Steve
Reply