1. Re: OpenGl again.

Hello,

  I've managed to narrow down the point of crash in the Cube.exw
demo in Paul Martin's OpenGL porting project. The mechanics of
*why* it was crashing still escapes me...

The project files can be obtained at Paul's site:

cube.zip:  http://www.geocities.com/CapeCanaveral/Campus/8684/Cube.zip
mesa dlls: http://www.geocities.com/CapeCanaveral/Campus/8684/mesa3dll.zip

The program stops crashing with the following modification to his
code:

--------------------------------------------------------------
-- reshape() re-coded by me to ignore the parameters
function my_reshape()
    glViewport (0,0,500,500)
    glMatrixMode(GL_PROJECTION)
    glLoadIdentity()
    glFrustum(-1.0, 1.0, -1.0, 1.0, 1.5, 20.0)
    glMatrixMode(GL_MODELVIEW)
    return 0
end function

function reshape (atom w, atom h)
    glViewport (0,0,w,h)
    glMatrixMode(GL_PROJECTION)
    glLoadIdentity()
    glFrustum(-1.0, 1.0, -1.0, 1.0, 1.5, 20.0)
    glMatrixMode(GL_MODELVIEW)
    return 0
end function

-- constant creshape = call_back(routine_id("reshape"))
constant creshape = call_back(routine_id("my_reshape"))
--------------------------------------------------------------

  As you can see, my_reshape() is the same as reshape()
except that it doesn't accept the parameters. The 500's
plugged into glViewport are what's normally passed in by
w and h until the window is resized. Examinining w and h
when they are passed to reshape() shows that they are
indeed passed in correctly. Only some time after returning
from reshape() does the program crash.

  reshape() is *supposed* to take the two integer parameters
tho. The C header has the following:

GLUTAPI void APIENTRY glutReshapeFunc(void (GLUTCALLBACK * func)(int width,
int height));

glutReshapeFunc() is to be initialized with a pointer to a call_back
function.

  Paul has it coded as follows:

in GLUT2.ew:
constant glut_ReshapeFunc  = define_proc(glut,"glutReshapeFunc",{C_POINTER})

global procedure glutReshapeFunc(atom callback)
        c_proc( glut_ReshapeFunc,{callback})
end procedure

in Cube.exw:
glutReshapeFunc(creshape)

Can anyone shed some light on what's happening here?

Thanks,
Christopher D. Hickman

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu