Results 1 to 5 of 5

Thread: crash with fog extension

  1. #1
    Senior Member Regular Contributor
    Join Date
    Feb 2000
    Location
    milano, italy
    Posts
    282

    crash with fog extension

    hello people.

    i wish to use the GL_EXT_fog_coord to custom fog a terrain (look at "problems with radial fog" topic, if interested)

    the code to extend opengl for fog vertex array:

    Code :
    PFNGLFOGCOORDPOINTEREXTPROC		glFogCoordPointerEXT;
     
    glFogCoordPointerEXT=(PFNGLFOGCOORDPOINTEREXTPROC)wglGetProcAddress("glFogCoordPointer");
    the setup/access code:

    Code :
     
    struct Tdmygridpoint {
    	Tdmyvert3f	vert;
    	Tdmyrgb3f	color;
    	Tdmytex2f	tex;
    	float		fogz;
    };
     
    Tdmygridpoint	grid[64*64];	// something equivalent
     
     
    glEnableClientState(GL_FOG_COORDINATE_ARRAY_EXT);
    // enable other arrays
     
    glFogCoordPointer(GL_FLOAT,sizeof(Tdmygridpoint),&grid->fogz);
    // specify other arrays access point
    rendering is done with calls to glArrayElement().

    but when opengl access to the fog array the application crashes.
    i've tested various approaches, but it still crash and i don't know why... i'm about to step through the LIB-ICD code, but i'd like to avoid it

    note that the function exist, and the compiler builds a correct call to it.

    since the way i extended opengl is the same as into a nvidia example for multitexturing, i don't think the problem is there...

    card is a geforce ddr.

    i'm going to download new drivers (if i find them and test them...

    in the meantime, does any of you had experiences with fog vertex array exts?
    suggestions/advices?

    thank you,

    Dolo/\/\ightY
    Dolo/\/\ightY

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,978

    Re: crash with fog extension

    Are you sure that glFogCoordPointerEXT is actually getting a correct value? wglGetProcAddress maybe fails to load and return NULL. Then you trying to call glFogCoordPointerEXT when it's pointing nowhere (well, NULL actually)?

    You said "note that the function exist, and the compiler builds a correct call to it". Yes, the compiler can make a correct call out of it, but you have to load the function before using it. glFogCoordPointerEXT is nothing more that a pointer to a function, so the compiler can't assign a value to it when compiling.

    Bob

  3. #3
    Senior Member Frequent Contributor
    Join Date
    Feb 2000
    Location
    France
    Posts
    880

    Re: crash with fog extension

    I am not sure but you should try passing "glFogCoordPointerEXT" instead of "glFogCoordPointer" to the wglGetProcAddress...

    I am using compiled vertex arrays and my calls are :
    glLockArraysEXT=(XPFNGLLOCKARRAYSEXTPROC) wglGetProcAddress("glLockArraysEXT");
    glUnlockArraysEXT=(XPFNGLUNLOCKARRAYSEXTPROC) wglGetProcAddress("glUnlockArraysEXT");

    And it works....

    Eric

    P.S. : I am really not sure about that but it's worth a try...

  4. #4
    Senior Member Regular Contributor
    Join Date
    Feb 2000
    Location
    milano, italy
    Posts
    282

    Re: crash with fog extension

    bob:
    yes, i am sure about the presence of the function: wgl returns the correct address, and i assign it correctly to the function pointer.
    with "the compiler builds..." i would meant this...
    also, i've checked many times the update glext.h header i use, and it agrees the extension specs.
    "...load the function": i agree, and if loading is achieved with just a call to wglGetProcAddress(), then it's all right up to now, and i have to check other things.

    eric:
    yes, i missed the EXT in this post.
    in my sources it is there, and i've also tested if without the EXT opengl will return the same value: without EXT it returns NULL.

    stepping through lib-icd code i see that the exception is invoked at "mov [edx],al" when edx==0...
    this makes me think about NULL pointers...
    maybe i've passed a NULL pointer somewhere...?
    no, everything is right.

    excuse me for those typos... keep on help !

    Dolo/\/\ightY
    Dolo/\/\ightY

  5. #5
    Senior Member Regular Contributor
    Join Date
    Feb 2000
    Location
    milano, italy
    Posts
    282

    Re: crash with fog extension

    ok, i've fixed it.
    it was not some error of mine, it was due to the drivers... the new 3.68 detonator drivers fix this problem.

    ...well, almost.

    the specs for EXT_fog_coord extension prototype the vertex array function like this:

    void FogCoordPointerEXT(enum type, sizei stride, void *pointer)

    that will end up into the extension header like this:

    typedef void (APIENTRY * PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer);

    now, i must suppose that nvidia done something wrong, since if i call the function with this prototype, the application crashes !!

    i had to re-prototype it to:

    void FogCoordPointerEXT(int size, enum type, sizei stride, void *pointer)

    so:

    typedef void (APIENTRY * PFNGLFOGCOORDPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);

    and set the size parameter always to 1.
    that's not a big problem...

    but who is right? nvidia or the specs?
    who i have to listen to?

    Dolo/\/\ightY


    [This message has been edited by dmy (edited 04-01-2000).]

    [This message has been edited by dmy (edited 04-01-2000).]
    Dolo/\/\ightY

Similar Threads

  1. #extension mechanism, query if extension is available?
    By eodabash in forum OpenGL: GLSL
    Replies: 3
    Last Post: 03-20-2013, 03:23 PM
  2. FBO extension?
    By frog04 in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 02-09-2009, 02:39 AM
  3. What is the ARB extension?
    By yaro_dup1 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 10-05-2002, 11:48 PM
  4. wgl Extension
    By p9931734 in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 03-07-2002, 07:23 PM
  5. Replies: 1
    Last Post: 09-17-2001, 01:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean