I've got a small program that will cause a segfault:

Program received signal SIGFPE, Arithmetic exception.
0x281824d8 in gl_x86_transform_points3_3d_no_rot_raw ()
   from /t/video/libGL.so.3
(gdb) bt
#0  0x281824d8 in gl_x86_transform_points3_3d_no_rot_raw ()
   from /t/video/libGL.so.3
#1  0x805c2f0 in ?? ()
#2  0x8062ba8 in ?? ()
#3  0x280aa34c in gl_Accum (ctx=0x0, op=GL_FALSE, value=0)
   from /t/video/libGL.so.3
#4  0x80c6000 in ?? ()

Yet this doesn't crash when run with a non-mesa OpenGL implementation, so
I'm leaning towards "Mesa Bug" here. This uses OSMesa, and I really don't
have any Mesa system with X installed to see if it's specific to OSMesa or
not. Here's the program given to me by a coworker. It contains a bit of our
specific glue to draw it using our display system, so ignore that bit. :)
This is using FreeBSD, which traps a lot of FP exceptions by default, should
I be turning these off?

-- Kevin



static char const rcsid[]=
"$Header: /TouchMaster_II/2.0x/contrib/OpenGl Example/junk_2.c 1     4/11/00 4:06p 
Mark $ ";

#include "/t/system/gamedef.h"
#include "/t/video/GL/osmesa.h"
#include "/t/video/GL/glu.h"
#include "math.h"

int shmid;
unsigned short *gl_memory;
OSMesaContext ctx;
sdisplaylist *obj;

double xang=0.0,yang=0.0,zang=0.0;

int InitalizeOpenGL(sdisplaylist *o,unsigned short *gl_memory,OSMesaContext *ctx);

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
int main(int argc,char *argv[])
{
        int c;

// OS Stuff
        CallMeFirst();
        OSConnect();
        obj=new sdisplaylist;
        DeleteObject(USEROID,0);
        SetFrameRate(3);
        srandom(time(0));
        
// Background polygon
        ClearObject(obj);
        obj->width=640;
        obj->height=480;
        obj->depth=0;
        obj->color=0x0000;
        obj->flags=DL_FLAGS_POLYGON;
        AddObject(obj);

// Open GL object
        ClearObject(obj);
        obj->useroid=0x4242;
        obj->depth=10;
        obj->xpos=192;
        obj->ypos=112;
        obj->width=256;
        obj->height=256;
        shmid=InitalizeOpenGL(obj,gl_memory,&ctx);

// Setup
        glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
        FadeGammaIn(100,5);
        while(!hit)
        {
                ReadTouchScreen(NULL);

                xang+=2.0;
                if(xang>360.0) xang-=360.0;
                yang+=1.7;
                if(yang>360.0) yang-=360.0;
                zang+=2.2;
                if(zang>360.0) zang-=360.0;

                CommitObjects();
                WaitForVsync();

                glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

                glPushMatrix();
                glTranslatef(0.0,0.0,-8.0);
                glRotated(xang,1.0,0.0,0.0);
                glRotated(yang,0.0,1.0,0.0);
                glRotated(zang,0.0,0.0,1.0);

                glBegin(GL_QUADS);

            glColor3ub(255,0,0);
                glVertex3f(1.0,1.0,1.0);
            glColor3ub(0,255,0);
                glVertex3f(-1.0,1.0,1.0);
            glColor3ub(255,255,0);
                glVertex3f(-1.0,-1.0,1.0);
            glColor3ub(0,0,255);
                glVertex3f(1.0,-1.0,1.0);

            glColor3ub(255,0,0);
                glVertex3f(1.0,1.0,-1.0);
            glColor3ub(0,255,0);
                glVertex3f(-1.0,1.0,-1.0);
            glColor3ub(255,255,0);
                glVertex3f(-1.0,1.0,1.0);
            glColor3ub(0,0,255);
                glVertex3f(1.0,1.0,1.0);

            glColor3ub(255,0,0);
                glVertex3f(1.0,-1.0,-1.0);
            glColor3ub(0,255,0);
                glVertex3f(-1.0,-1.0,-1.0);
            glColor3ub(255,255,0);
                glVertex3f(-1.0,1.0,-1.0);
            glColor3ub(0,0,255);
                glVertex3f(1.0,1.0,-1.0);

            glColor3ub(255,0,0);
                glVertex3f(1.0,-1.0,1.0);
            glColor3ub(0,255,0);
                glVertex3f(-1.0,-1.0,1.0);
            glColor3ub(255,255,0);
                glVertex3f(-1.0,-1.0,-1.0);
            glColor3ub(0,0,255);
                glVertex3f(1.0,-1.0,-1.0);

            glColor3ub(255,0,0);
                glVertex3f(1.0,1.0,-1.0);
            glColor3ub(0,255,0);
                glVertex3f(1.0,1.0,1.0);
            glColor3ub(255,255,0);
                glVertex3f(1.0,-1.0,1.0);
            glColor3ub(0,0,255);
                glVertex3f(1.0,-1.0,-1.0);

            glColor3ub(255,0,0);
                glVertex3f(-1.0,1.0,1.0);
            glColor3ub(0,255,0);
                glVertex3f(-1.0,1.0,-1.0);
            glColor3ub(255,255,0);
                glVertex3f(-1.0,-1.0,-1.0);
            glColor3ub(0,0,255);
                glVertex3f(-1.0,-1.0,1.0);

                glEnd();

                glFlush();

                glPopMatrix();

        }
        FadeGammaOut(100,GAMMA_FADE_OUT);
}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
int InitalizeOpenGL(sdisplaylist *o,unsigned short *gl_memory,OSMesaContext *ctx)
{
        int shmid;
        sdisplaylist *obj=new sdisplaylist;
        GLfloat h=(GLfloat)o->height/(GLfloat)o->width;

// Create open gl object
    ClearObject(obj);
    obj->useroid=o->useroid;
    obj->width=o->width;
    obj->height=o->height;
    obj->usermisc=32;
    gl_memory=ShareRegion(obj,&shmid);

    CommitObjects();
    WaitForVsync();

// Add open gl object
    ClearObject(obj);
        obj->useroid=o->useroid;
    obj->key=shmid;
    obj->depth=o->depth;
        obj->xpos=o->xpos;
        obj->ypos=o->ypos;
    AddObject(obj);
    CommitObjects();

        delete obj;

// Create open gl context
    *ctx=OSMesaCreateContext((GLenum)OSMESA_ARGB,NULL);
    OSMesaMakeCurrent(*ctx,gl_memory,GL_UNSIGNED_BYTE,o->width,o->height);

// View settings
        glClearColor(0.5,0.0,1.0,1.0);
        glViewport(0,0,(GLint)o->width,(GLint)o->height);
        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        glFrustum(-1.0,1.0,-h,h,5.0,500.0);
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();

// Culling
        glEnable(GL_DEPTH_TEST);
        glEnable(GL_CULL_FACE);
        glFrontFace(GL_CCW);
        glCullFace(GL_BACK);

        return(shmid);
}


_______________________________________________
Mesa-bug maillist  -  [EMAIL PROTECTED]
http://lists.mesa3d.org/mailman/listinfo/mesa-bug


_______________________________________________
Mesa-dev maillist  -  [EMAIL PROTECTED]
http://lists.mesa3d.org/mailman/listinfo/mesa-dev

Reply via email to