[xcrysden] XCrySDen: Build for openSUSE / crash under x86-64 due to a missing rendering context
Tobias Burnus
burnus at net-b.de
Tue Jan 19 17:28:55 CET 2010
Hello,
I have build XCrySDen for openSUSE/SLES; feel free to use/link to
See: http://software.opensuse.org/search?baseproject=ALL&p=1&q=xcrysden
Those builds work like a charm under x86(-32, i686) but they crash under
x86-64, which seems to be a bug in XCrySDen (which by chance works under
i686): There seems to be no OpenGL rendering context when calling
C/lightning.c's LoadLights. The crash happens for the first call to
glLightfv, namely:
/* take care of lights */
for ( il=0; il<GLPAR_MAXLIGHT; il++) {
if ( light[il].isenabled ) {
glLightfv(_LIGHT[il], GL_AMBIENT, light[il].ambient);
The issue can be reproduced when creating a program (cf. below) which
just contains the call to glLightfv. If I use GLUT to create a rendering
context before calling glLightfv, it works on x86-64 without crashing.
I have been told that calling glLightfv without first creating a
rendering context is a bug, cf.
http://sourceforge.net/mailarchive/message.php?msg_name=4B55D3B5.9010506%40vmware.com
Could you please fix XCrySDen in this regard. Thanks!
I have also filled a bugreport for Mesa to fix the NULL pointer issue,
cf. https://bugs.freedesktop.org/show_bug.cgi?id=26121
Tobias
PS: The issue is not new, there was before a report of this crash, cf.
http://www.democritos.it/pipermail/xcrysden/2007-May/000375.html
PPS: The minimal working/failing example is:
#include <GL/gl.h>
#include <GL/glut.h>
int main (int argc, char** argv)
{
GLfloat ambient[4] = {0.2, 0.2, 0.2, 1.0};
/* It crashes on x86-64 when one comments all glut* lines. */
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize (250, 250);
glutInitWindowPosition (100, 100);
glutCreateWindow ("hello");
glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
glutMainLoop();
return 0;
}
PPPS: In order to build XCrySDen, I had to patch C/readstrf.c to use
"size_t linesize" rather than "int". Additionally, I had to disable the
internal implementation of getline/getdelim in favour of the glibc
version (i.e. #define _GNU_SOURCE; #include <stdio.h> in C/getline.h).
Additionally, I had to add a missing protype for
cryGeneralGridRegPeriodInterpolator_f_LCASI3D:
--- C/crySurf.c.orig 2009-12-09 19:29:25.000000000 +0100
+++ C/crySurf.c 2009-12-09 19:35:07.000000000 +0100
@@ -46,6 +46,7 @@
extern void xcSurfSmoothing( ISOSURFACE *iso, float isolevel );
extern float ***cryRegPeriodInterpolator_f_LCASI3D(int n[3], int
degree[3], float ***src);
+extern float ***cryGeneralGridRegPeriodInterpolator_f_LCASI3D(int[3],
int[3], float***);
static void Set_Orig_and_Size( NEW_WIN_CONTEXT *wc, MOL_SURF *m,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.democritos.it/pipermail/xcrysden/attachments/20100119/28396f86/attachment.htm
More information about the XCrySDen
mailing list