Does Using Xvfb to Run Opengl Effects Version

unknown GLU entry gluOrtho2D using opengl in Haskell

This is a definite bug. There is a problem with the linker (and I'm not sure if this is specific to 11.10 or to GHC 7.0+). Here's how it was explained to me: the linker essentially decides that, since you're not linking statically to libglut, it will just optimize by not linking your executable to it at all. You can get around this by applying the following patch to GLURaw 1.1.0.0:

diff -ur GLURaw-1.1.0.0.orig/cbits/HsGLURaw.c GLURaw-1.1.0.0/cbits/HsGLURaw.c
--- GLURaw-1.1.0.0.orig/cbits/HsGLURaw.c 2011-05-12 09:02:30.000000000 +1200
+++ GLURaw-1.1.0.0/cbits/HsGLURaw.c 2011-05-11 23:08:10.000000000 +1200
@@ -68,6 +68,9 @@

#include <stdlib.h>
#include <dlfcn.h>
+#include <stdio.h>
+#include <GL/glu.h>
+

void*
hs_GLU_getProcAddress(const char *name)
@@ -80,6 +83,7 @@
/* Get a handle for our executable. */
handle = dlopen(NULL, RTLD_LAZY);
}
+ printf("%p\n", gluBeginCurve);

return handle ? dlsym(handle, name) : NULL;
}
Only in GLURaw-1.1.0.0: dist

Run cabal install on GLURaw after applying this patch, and it should get rid of this problem.

How to use GLUT/OpenGL to render to a file?

You almost certainly don't want GLUT, regardless. Your requirements don't fit what it's intended to do (and even when your requirements do fit its intended purpose, you usually don't want it anyway).

You can use OpenGL. To generate output in a file, you basically set up OpenGL to render to a texture, and then read the resulting texture into main memory and save it to a file. At least on some systems (e.g., Windows), I'm pretty sure you'll still have to create a window and associate the rendering context with the window, though it will probably be fine if the window is always hidden.



Related Topics



Leave a reply



Submit