[HOpenGL] Extension problem (narrowed)

Yann Morvan morvany at cs.tcd.ie
Sun Oct 10 17:29:56 EDT 2004


I have been playing around with the extension wrapper and I feel like I am
missing something.

When I add the following code to Alpha.hs:

foreign import stdcall unsafe "dynamic" dyn_glBlendEquationEXTbogus ::
Graphics.Rendering.OpenGL.GL.Extensions.Invoker (GLenum -> IO ())

myBlendEquation2 :: GLenum -> IO ()
myBlendEquation2 val = do
   ptr <- getProcAddress "EXT" "glBlendEquationEXT"
   putStr ("Address of glBlendEquationEXT: " ++ (show ptr) ++ "\n")
   (dyn_glBlendEquationEXTbogus ptr) val

things work ok (I replace the action in blendEquation by a print so that
blending is enabled without glBlendEquation to be called through the
HOpenGL wrapper, and then I call myBlendEquation2 in the keyboard
callback to toggle between equations).

If I just move that code unchanged into PerFragment.hs,
modifying it so that the functions are exported, and importing it
explicitely in Alpha.hs, I get an access violation upon calling
myBlendEquation2.

Am I missing a GHC flag or functionnality to guide the loading of dynamic
bits of code ?
How does the program know which dll to load ?

	Yann

P.S. The code of my wrapper is a bit different from the one in
HsOpenGLExt.h, I was wary of the unsafePerformIO in there,
I hope the difference is irrelevent. If it is, tell me why.
(I know there is a loss of generality, but for the momment I am trying to
just get blendEquation to work)


More information about the HOpenGL mailing list