Silverfrost Forums

Welcome to our forums

Error during compilation with OpenGL glRenderMode

2 Nov 2013 6:32 #13262

Good evening,

For selecting objects in OpenGL I need to get the return value of glRenderMode, which doesn't seem to be possible with FTN95. The compiler tells me that glRenderMode is a subroutine, when it's supposed to be a function. Any Ideas how to get the return value of glRenderMode?

2 Nov 2013 8:20 #13263
      STDCALL GLRENDERMODE 'glRenderMode' (VAL):INTEGER*4

is in opengl.ins.

Either the declaration is missing from your code or it is incorrect.

3 Nov 2013 1:49 #13264

Declaration in opengl.ins is correct; this is my code:

! Includes
			use gl_data
			include <opengl.ins>
			
			! Variables
			integer :: buffer(512)
			integer :: hits
			integer :: viewport(4)
			integer :: x,y
			call glGetIntegerv(GL_VIEWPORT,viewport)
			
			! Select hit buffer
			call glSelectBuffer(512,buffer)
			
			! Set render mode to select
			call glRenderMode(GL_SELECT)
			
			! Init name stack
			call glInitNames()
			call glPushName(0)
			
			! Set up viewing volume
			call glMatrixMode(GL_PROJECTION)
			call glPushMatrix()
			call glLoadIdentity
			write (*,*) dble(x),dble(glHeight-y),viewport
			call gluPerspective(30.0d0,glRatio,1d0,15d0)
			call gluPickMatrix(dble(x),dble(glHeight-y),1.0d0,1.0d0,viewport)
			
			! Draw
			call glMatrixMode(GL_MODELVIEW)
			call glLoadIdentity()
			call openglTransformations(GL_SELECT)
			call openglDraw3D(.true.,GL_SELECT)
			
			! Rebuild old matrix
			call glMatrixMode(GL_PROJECTION)
			call glPopMatrix()
			call glFlush()
			
			! Process hits
			hits =  glRenderMode(GL_RENDER)	

FTN95 still tells me, that glRenderMode is a subroutine.

3 Nov 2013 1:52 #13265

Found my error, if glRenderMode is called like a subroutine before, FTN95 refuses to see it as a function.

Please login to reply.