- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a problem with some module interfaces for opengl GLUT utilities. The interface was written with bind(c) but with the stdcall api libararies this does not work (i believe). I did a small code that auto edited the module removing bind(c) and adding !dec attributes. The seem to be OK but there is one routine shown below that I really don't get. It is the relations/use of glutinit, glutinit_f03 & glutinit_gl that confuses me . I get 1 link error:
1>nOpenGL_glut.obj : error LNK2019: unresolved external symbol _glutInit referenced in function _OPENGL_GLUT_mp_GLUTINIT_F03
dumping the lib header I have a decorated Symbol name : _glutInit@8
I guess I need to remove bind C an add something like:
!DEC$ ATTRIBUTES STDCALL, REFERENCE, DECORATE, ALIAS:"undecorated_libname" :: name
Please could someone advise.
[fortran]
!in the aplication we have
use OpenGL_glut
call glutInit()
!we have the module interface fpr glutinit as below
MODULE OpenGL_glut
! Initialization functions, see og_init.c
! void glutInit( int* pargc, char** argv )
PUBLIC glutInit
INTERFACE glutInit
MODULE PROCEDURE glutInit_f03
SUBROUTINE glutInit_gl(pargc, argv) BIND(C,NAME="glutInit")
IMPORT
INTEGER(GLint) :: pargc
! INTEGER(GLint), DIMENSION(*) :: pargc
TYPE(C_PTR), INTENT(IN) :: argv
END SUBROUTINE glutInit_gl
MODULE OpenGL_glut
[/fortran]
1>Linking...
1>nOpenGL_glut.obj : error LNK2019: unresolved external symbol _glutInit referenced in function _OPENGL_GLUT_mp_GLUTINIT_F03
!DEC$ ATTRIBUTES STDCALL, REFERENCE, DECORATE, ALIAS:"undecorated_libname" :: name
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Microsoft removed the GLUT routines several VS releases ago - do you really still want to use it? I rewrote all the Intel Visual Fortran samples to remove the use of GLUT. However, if that's what you want, your proposed change of the interface is exactly what you need.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[fortran]SUBROUTINE glutInit_gl(pargc, argv) !BIND(C,NAME="glutInit")
!DEC$ ATTRIBUTES STDCALL, REFERENCE, DECORATE, ALIAS:"glutInit" :: glutInit_gl
IMPORT[/fortran]
Was the fix, the programs all run OK now. What confused me was the double aliasing using the module procedue. glutint > glutInit_f03 >glutInit_gl > _glutinit@8
Microsoft removed GLAux which was their equivalent to Glut. I have used some code from the Rings sample to do some trials in my application which works OK but the basic OpenGL does at best GL_SMOOTH which is implimented as Gourad shading (linear interpolation of colours at vertex). This gives a faceted appearance in most applications. I wanted the option for Phong shading (interpolation of normals) which is not supported in basic GL/GLU. The other functionality I need to impliments is dynamic spin/pan/zoom using the mouse, the latter i could do by writing code around the windows handler in 'rings' but using some existing (working) code would be prefferable....
I have been looking at various sample codes that use GLSW /GLEW (open GL extrensions with more advanced fragment shaders and hardware support) but all the samples are built over GLUT or freeGLUT hence my need to have the GLUT interface working in this evaluation stage.
About 23 years ago wrote (in MS Fortran an still use in my Ifort app!) a 3d gourad/phong shader with my own z/frame buffers that basically just uses SETPIXELRGB, I want to update this with more functionality so using existing 3D technolgy seem like the way forward but it is proving a little more difficult than anticipated...
If anyone has some experiance in this area in Fortran it woud ne appeciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am a somwhat inexperienced user of opengl_gl* libraries within IVF. I think the issue you discussed about the vertex shading was an issue that has bugged me: jaggy and/or coarse looking fine (color and black) lines. The application in which I use OpenGL also uses Array Visualizer. I would prefer using AV as it is better performing when coupled into my "FE" simulation program. I had to switch to OpenGL because there is a bug in AV in large 3D plots whereby some lines get dropped. I could not resolve the issue with work arounds so I ported the graphics to OpenGL. I get all the lines now, however they are jaggy. OpenGL lacks the features and performance of AV (as integrated into the applicaiton). Intel dropped AV, I wish they would bring it back, it was really great (though apparently misunderstood) product.
If you are willing and permitted to upload your interface code (with helper routines for mouse and keyboard), and indicate which OpenGL library is compatible, it would be helpful for other readers of this forum.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Jim. Since I made that post earlier this morning I have been working further on this....
I currently have examples of all the bits I need GLUT (in fortran), dynamic zoom/pan/rotate using mouse with GLUT (this is currenty in C but it looks pretty straight forward to make a fortran module which I plan to do soon). I still need some work on the shader as a have a fragment shader working in C (using GLUT/OpenGl/OpenGL extensions). when I have got in all in a working form I have will post some resources.
Andrew
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can clean up jagged lines in OpenGL, it's just a little more difficult that one might have expected. You have to enable smoothing for the type of object you are drawing, then hint for GL_NICEST, then enable GL_BLEND and call glBlendFunc. Omitting any of these steps leaves you with jagged lines.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page