PDA

View Full Version : error message on 64-bit machine



FredB
12-22-2008, 04:45 PM
Hi,
I'm using opengl to creat a tessellation object. Here is the code snippet I have that does this,
GLUtesselator * tobj = NULL;
tobj = gluNewTess();
gluTessCallback(tobj, GLU_TESS_VERTEX, (GLvoid (*) () ) &glVertex2dv;
gluTessCallback(tobj, GLU_TESS_BEGIN, (GLvoid (*) () ) &beginCallback;
gluTessCallback(tobj, GLU_TESS_END, (GLvoid (*) () ) &endCallback;
gluTessCallback(tobj, GLU_TESS_ERROR, (GLvoid (*) () ) &errorCallback;
gluTessBeginPolygon(tobj, NULL);
gluTessBeginContour(tobj);
for(int i=0;i<array.size();i++)
{
gluTessVertex(tobj,array[i],array[i]);
}
gluTessEndContour(tobj);
gluTessEndPolygon(tonj);
gluDeleteTess(tobj);

All the call back functions are defined appropriately and array, is an array of GLdouble s containing the vertices' coordinates. When I run my code on a 32-bit machine, everything is fine, but when I run it on a 64-bit machine, I get the error message " a coordinate is too large." This definitely is not the case since my largest coordinate is about 1000. Has anyone ever encountered anything similar to this? Does anyone know why this is happening and what the solution is? any help is greatly appreciated. Thanks,
Fred

dletozeun
12-23-2008, 07:13 AM
Duplicate threads may increase your visibility, but will not make people want to help you more.
Perhaps, we would be able to help you if you try to be more precise. I mean, on which platform, hardware are you working on? Does that happens with all opengl applications? only with glu? How do you use your program? Have you tried to compile it for your 64bits machine, do you use gl, glu binaries compiled for your 64-bits platform?

Right now, I have no idea of why it is working, this may not be related to opengl or glu.

FredB
12-23-2008, 06:02 PM
It's a Linux os running on a x86-64 platform. This problem happens only with opengl applications and only this specific case. I'm using opengl to draw rectangles all over the place. This is happening only when I add the above piece of code trying to create a tessellation object. I am using gl libraries compiled for this platform. The program gives me this error after executing this line ,

gluTessVertex(tobj,array[i],array[i]);

dletozeun
12-24-2008, 04:22 AM
Ok, by the way, from what do you get the error message "a coordinate is too large."? Is it from error handling in your program?

FredB
12-24-2008, 01:23 PM
well, it's from the errorCallback function above. This is how the errorCallback function is defined,

void errorCallback(GLenum errorCode)
{
const GLubyte *estring;
estring = gluErrorString(errorCode);
fprintf(stderr,"Tessellation Error: %s\n", estring);
exit(0);
}

so the "coordinate too large" error message is received from the gluErrorString function after gluTessVertex function in the for loop encounters an error.

dletozeun
12-25-2008, 03:43 PM
I have found here (http://download.java.net/media/jogl/builds/nightly/javadoc_public/javax/media/opengl/glu/GLUtessellatorCallbackAdapter.html)(search for "large"), that this kind of error is thrown if a coordinate is higher than a constant value: GLU_TESS_MAX_COORD (which is for example on my machine: 1.0e+150).
In addition they say:



Coordinate values must be small enough so that two can be multiplied together without overflow.


So even if you are sure of your input values, there must be somewhere a value too large... Maybe, you do some data conversions that corrupt your data... but I don't see for now, the link with the 64bits machine. Take care of data types and use OpenGL redefined ones, like GLfloat, GLdouble...

idr
12-30-2008, 01:03 AM
Try replacing the GLU_TESS_VERTEX with something that will print the vertex data out. It's possible that there's some alignment issue that's causing pointers to be "off" on the 64-bit platform. At the very least, it would help determine which data it thinks is bad.

FredB
01-06-2009, 10:21 PM
I'm using GLdouble everywhere and I'm printing out the values before the call to the gluTessVertex function and they are all correct. I just cout ed them.