Page 1 of 6 123 ... LastLast
Results 1 to 10 of 59
  1. #1
    d1R3c764 & g1|\|64 m4|<3R Orkin's Avatar
    Join Date
    Mar 2002
    Location
    Oklahoma, USA
    Posts
    267

    Writing an OpenGL N64 GFX plugin...having trouble with PJ64...

    Ok, here's the deal. I'm starting an OpenGL GFX plugin for N64 emus (I was doing one in D3D and got pretty far, but now I've decided to move over to OGL), but I'm having trouble getting it to work right with PJ64. I can start a ROM, and it displays fine, but when I try to end the emulation, the emu freezes with a partially drawn ROM selection window.

    After putting some debugging code in I found that it's not unsetting the current rendering context, so when the window gets destroyed, OGL throws a fit.

    The funny thing is it works fine in other emus (e.g. 1964), no problems unsetting the current context, and no freezing whatsoever.



    I'd say it's a problem with PJ64, but I know (at least) Jabo and Azimer got OGL to work with PJ64, so it must be something I'm missing...even though I've tried everything I can think of.

    Anyway, if anyone has any ideas, I'd greatly appreciate the help.

    Thanks,
    Orkin


    • Advertising

      advertising
      EmuTalk.net
      has no influence
      on the ads that
      are displayed
        
       

  2. #2
    Emutalk Member linker's Avatar
    Join Date
    Nov 2001
    Location
    157772039
    Posts
    516

    Re: Writing an OpenGL N64 GFX plugin...having trouble with PJ64...

    Originally posted by Orkin
    Ok, here's the deal. I'm starting an OpenGL GFX plugin for N64 emus (I was doing one in D3D and got pretty far, but now I've decided to move over to OGL), but I'm having trouble getting it to work right with PJ64. I can start a ROM, and it displays fine, but when I try to end the emulation, the emu freezes with a partially drawn ROM selection window.

    After putting some debugging code in I found that it's not unsetting the current rendering context, so when the window gets destroyed, OGL throws a fit.

    The funny thing is it works fine in other emus (e.g. 1964), no problems unsetting the current context, and no freezing whatsoever.

    I'd say it's a problem with PJ64, but I know (at least) Jabo and Azimer got OGL to work with PJ64, so it must be something I'm missing...even though I've tried everything I can think of.

    Anyway, if anyone has any ideas, I'd greatly appreciate the help.

    Thanks,
    Orkin
    I know about this problem. So check this out:

    BOOL lgl_Release()
    {
    DebugMsg("Releasing OpenGL...");
    if (hGLRC)
    {
    if ((!wglMakeCurrent(NULL, NULL)) && (!FALSE))
    {
    MessageBox(NULL, "wglMakeCurrent() failed!\n", "ERROR", MB_OK|MB_ICONSTOP);
    return FALSE;
    }
    if (!wglDeleteContext(hGLRC))
    {
    MessageBox(NULL, "wglDeleteContext() failed!\n", "ERROR", MB_OK|MB_ICONSTOP);
    return FALSE;
    }
    hGLRC = NULL;
    }
    if (hPalette)
    {
    if(!DeleteObject(hPalette))
    {
    MessageBox(NULL, "DeleteObject() for hPalette failed!\n", "ERROR", MB_OK|MB_ICONSTOP);
    return FALSE;
    }
    hPalette = NULL;
    }
    if (hDC)
    {
    if (!ReleaseDC(gfx.hWnd, hDC))
    {
    //MessageBox(NULL, "ReleaseDC failed!\n", "ERROR", MB_OK|MB_ICONSTOP);
    return FALSE;
    }
    hDC = NULL;
    }

    DebugMsg("OpenGL released");
    return TRUE;
    }
    <B>My Mk4 Combos:</B> <a href="http://zelda.hit.bg/sonya.avi">Sonya</a> | <a href="http://zelda.hit.bg/reiko.avi">Reiko</a> | <a href="http://zelda.hit.bg/reptile.avi">Reptile</a>

  3. #3
    Moderator Quvack's Avatar
    Join Date
    Nov 2001
    Location
    Melbourne, Australia
    Posts
    574
    As far as I know there was a problem with PJ1.4 with opengl, im not quite sure tho :\

  4. #4
    omg h4x CpU MasteR's Avatar
    Join Date
    Nov 2001
    Location
    Yuma Arizona, USA
    Posts
    1,507
    Well, I remeber Azi saying something about the OGL Thread...
    /me draws a blank

  5. #5
    d1R3c764 & g1|\|64 m4|<3R Orkin's Avatar
    Join Date
    Mar 2002
    Location
    Oklahoma, USA
    Posts
    267
    Thanks for the replies

    linker: Umm...I don't really see anything different in the code you posted. Just looks like a regular OpenGL shutdown routine, which I already have, the problem is it's not working right with PJ64.

    Quvack: Do you know if there's a way to work around it?

    CpU MasteR: Hmm...I guess I should try to track down Azimer...

    Even though I'm still have trouble with shutdown, I'm going ahead with development anyway, since I'll eventually figure it out. It doesn't display anything yet, but I got all the basic structure in there (runs through the display lists and all, just doesn't actually process them yet). I think I'm going to spend a little time on a good debugger before I go much further though.

  6. #6
    Moderator Cyberman's Avatar
    Join Date
    Nov 2001
    Posts
    1,824
    Originally posted by Orkin
    Thanks for the replies

    linker: Umm...I don't really see anything different in the code you posted. Just looks like a regular OpenGL shutdown routine, which I already have, the problem is it's not working right with PJ64.

    Quvack: Do you know if there's a way to work around it?

    CpU MasteR: Hmm...I guess I should try to track down Azimer...

    Even though I'm still have trouble with shutdown, I'm going ahead with development anyway, since I'll eventually figure it out. It doesn't display anything yet, but I got all the basic structure in there (runs through the display lists and all, just doesn't actually process them yet). I think I'm going to spend a little time on a good debugger before I go much further though.
    It is always a good idea to have a good debugger! TRUST ME!

    I think the cause is PJ64 shuts down .. period including the window context used for the OGL. If you have a way of checking if the emulator is indeed closing the window perhaps you can fork an exception handler that closes the OGL context and then returns letting the window be closed normally?

    Cyb
    Progress (n.):
    The process through which the Internet has evolved from smart people in front of dumb terminals to dumb people in front of smart terminals.
    -------------------------------------------------------------------
    Recursive (adj):
    see Recursive

  7. #7
    Emutalk Member linker's Avatar
    Join Date
    Nov 2001
    Location
    157772039
    Posts
    516
    Originally posted by Orkin
    Thanks for the replies

    linker: Umm...I don't really see anything different in the code you posted. Just looks like a regular OpenGL shutdown routine, which I already have, the problem is it's not working right with PJ64.
    Hmm.. it is working for me
    <B>My Mk4 Combos:</B> <a href="http://zelda.hit.bg/sonya.avi">Sonya</a> | <a href="http://zelda.hit.bg/reiko.avi">Reiko</a> | <a href="http://zelda.hit.bg/reptile.avi">Reptile</a>

  8. #8
    Moderator
    Join Date
    Nov 2001
    Posts
    256
    where are you calling your shutdown rutines from ? you might find you are calling them to late or something ..

  9. #9
    d1R3c764 & g1|\|64 m4|<3R Orkin's Avatar
    Join Date
    Mar 2002
    Location
    Oklahoma, USA
    Posts
    267
    I'm starting OGL in RomOpen, and stopping it in RomClosed.

    Should I do it somewhere else?

  10. #10
    d1R3c764 & g1|\|64 m4|<3R Orkin's Avatar
    Join Date
    Mar 2002
    Location
    Oklahoma, USA
    Posts
    267
    In case anyone cares, here are a few shots of tonight's progress...

    Here you can see that textures aren't implemented yet
    Attached Thumbnails Attached Thumbnails oglshot1.gif  

Page 1 of 6 123 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •