PDA

View Full Version : Writing an OpenGL N64 GFX plugin...having trouble with PJ64...



Orkin
April 17th, 2002, 12:12
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

linker
April 18th, 2002, 05:12
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;
}

Quvack
April 18th, 2002, 07:58
As far as I know there was a problem with PJ1.4 with opengl, im not quite sure tho :\

CpU MasteR
April 18th, 2002, 10:03
Well, I remeber Azi saying something about the OGL Thread...
/me draws a blank :(

Orkin
April 18th, 2002, 20:30
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.

Cyberman
April 19th, 2002, 01:58
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

linker
April 19th, 2002, 02:41
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

zilmar
April 19th, 2002, 04:43
where are you calling your shutdown rutines from ? you might find you are calling them to late or something ..

Orkin
April 19th, 2002, 09:51
I'm starting OGL in RomOpen, and stopping it in RomClosed.

Should I do it somewhere else?

Orkin
April 19th, 2002, 12:29
In case anyone cares, here are a few shots of tonight's progress...

Here you can see that textures aren't implemented yet

Orkin
April 19th, 2002, 12:47
No lighting either. The funky colors are because I'm interpreting normals as color values at the moment.

Orkin
April 19th, 2002, 13:02
At least the lighting on the castle is right (only 'cause it's static)

I think I'm going to tackle lighting next...

IceLord
April 19th, 2002, 14:38
that is looking great :)
keep it up ;)
EDIT: and if you need a beta tester im your man :)

mesman00
April 19th, 2002, 19:27
sweet, another plugin to follow!

Hiperzone
April 19th, 2002, 19:34
hehehe, keep the good work :).

Cyberman
April 19th, 2002, 21:04
Originally posted by Orkin
At least the lighting on the castle is right (only 'cause it's static)

I think I'm going to tackle lighting next...

Well that is a very colorful Super Mario 64!

It's chromatic even ;)

Looks like you are making decent progress, now I'll be interested when you get to fog ;)

Cyb

sk8bloke22
April 19th, 2002, 21:15
if u need a tester at all im happy to help. otherwise good luck. :)

nObedienz
April 19th, 2002, 23:17
sure wouldnt mind being one of your trustworhty helpers :cool:
I may not be that active on this board, but, when something this
interesting pops up, i just have to be a part of it :D
though my specs might be a little low ???
celeron 400, tnt2riva 32mb, 384mb ram

pj64er
April 20th, 2002, 02:45
sign me up for testing as well. :D

Azimer
April 20th, 2002, 02:52
Orkin,

My only solution thus far is to turn off the rombrowser. You can do this in PJ64's settings. I am still investigating workarounds or perhaps work on my own patch for the .exe to make it work right.

flow``
April 20th, 2002, 04:21
heh.. did you guys not read my post about not asking to beta test? he'll ask for testers when he needs them.

nObedienz
April 20th, 2002, 04:37
didnt read any post about not asking to beta test ;)
i only read positive things! lol.. :cool:
anyway, im sorry, im kinda a n00b to this forum :D

DVRipperD
April 20th, 2002, 05:14
Looks like the emu64 scene is rising up again with these very nice plugins. :satisfied :D

Keep up the good work!

BTW and correct me if I'm wrong,

Doesn't this plugin mean that we can use our GF cards for this, surely going to be great, plugin? :thumbsup:

lightknight
April 20th, 2002, 06:23
? what are you writeing your plugin in??

The Khan Artist
April 20th, 2002, 08:20
Well, that code of linker's looks awfully like C++...

nObedienz
April 20th, 2002, 15:24
damn...that dave2001 keeps impressing me..he's only 16 years
old and..what a future.. *whoops* wrong thread :P
anyway, i wont remove it cuz its true :innocent:
this plugin looks promising too, those early screens
looks really good!

Doomulation
April 21st, 2002, 02:34
I think I'll stand up as a beta-tester if asked, this could be fun.
Good luck, dude.

Orkin
April 21st, 2002, 03:22
I've worked on it a few hours today, and although most of the changes were either internal things (I rearranged alot of it so it makes more sense), or small things (viewports, scissor regions, fillrects...), I did manage to get lighting working.

Here are the results:

Orkin
April 21st, 2002, 03:26
Here's another shot:

Orkin
April 21st, 2002, 03:39
Next thing to add is texturing (and a configuration dialog).

Oh, and thanks for your replies everyone. I didn't think anyone would care about my dinky little plugin. :)

Azimer: Okay. The rom browser doesn't seem to freeze when I do a release build, although it still won't kill the rendering context, or release the DC smoothly... ???

lightnight: C++, may add some assembler in for optimization later on though.

DVRipperD: Yeah, it works with GeForce cards (that's what I have).

nObedienzn: I'm very impressed by him too. I can only hope my plugin gets as good as his...

And for those of you that wanted to help test it:

decription
April 21st, 2002, 05:43
Looks great man. Ignore lighnight and his ignorance. I doubt he understands C/C++. I mean c'mon he tlaked about porting 1964 to xbox in open gl. He also wants to make a gamecube 'emulatore' lol. He probably doesn't even know BASIC

lightknight
April 21st, 2002, 06:45
i have been studying C++ on the net for about ayear now!!!
i just can't get any thing to complie under dec++ i am trying to make a gfx plugin in sdl and opengl and in glide useing daves2000 code and updateing it as i go.. along with the but i keep geting these dum errors when trying to complie the code..i am try to fix the errors!!! but it is hard in dev c++. i was thinking about the 3 of making making them into one plugin!! if i can.. that would make 1 awsome plugin!!!! so get lost decription..... i know way more about emuation than you!!! i have patch way many games in ultrahle back in 1999 when it 1st came out..that no 1 has yet to...my plugin is FOR REAL!!!!!!!!!!!!!!!!!!!!!!!!!

gokuss4
April 21st, 2002, 07:17
lightknight, a tip... GET VC++ 6. download it off of kazaa or something

Malcolm
April 21st, 2002, 08:11
Originally posted by gokuss4
lightknight, a tip... GET VC++ 6. download it off of kazaa or something

he means go to a store and buy it

/me slaps gokuss4

sk8bloke22
April 21st, 2002, 08:53
mario64 is super fast at the moment...it looks well cool the mario64 face with the white background, hehe. I guess u know wats on ur 'to do' agenda, thanks for letting ppl sample ur work though. and good luck :)

gokuss4
April 21st, 2002, 09:15
Originally posted by Malcolm


he means go to a store and buy it

/me slaps gokuss4

sorry :D

mesman00
April 21st, 2002, 10:50
lightknight, shutup!! atleast until u show us something. now lets get back on topic

Slougi
April 21st, 2002, 18:42
guys stay on topic. if u wanna flame lightknight do that elsewhere. ktnx. just downloading the plugin btw ;)

DK64
April 22nd, 2002, 01:35
look'n good, get on IRC and u can start sorting out hosting ;)

btw, where did u find ur info on the RCP?

2fast4u
April 22nd, 2002, 03:09
dude, this looks impressive :colgate: keep up the nice work. :thumbsup:

Dave2001
April 22nd, 2002, 03:15
I'd say you have a pretty nice start on it so far ;). If you ever need help, feel free to ask me some questions. (I am the author of Glide64)

Gugaman
April 22nd, 2002, 12:59
Originally posted by Dave2001
(I am the author of Glide64)

even my lil cousin know that... and anyway, its below your avatar just in the left side :P

Ogy
April 22nd, 2002, 17:00
Glide64? whats that?? dave2001?!? are you the same dave from final burn? can you give me links to R0mZ?

Renegade
April 22nd, 2002, 17:22
what a funny man this Ogy is! oh btw may i please have your final burn beta dave? I know you're hidin it somewhere! ohg please please please please please!! I"LL EVEN LICK YOUR SHOES! :plain: :plain2: :!!!: :angry:

Doomulation
April 22nd, 2002, 17:31
Originally posted by DK64
look'n good, get on IRC and u can start sorting out hosting ;)

btw, where did u find ur info on the RCP?
No need to search for a host.
I know a place which could host it. This place hosts me and dave as well.
If you wanna know, it's: EmuXHaven (http://www.emuxhaven.net). Also on IRC, EFNet and NewNet (#emuxhaven).

mesman00
April 22nd, 2002, 20:53
hey doom, what program are u the author of? can i get a link to ur site, thanks

Remote
April 22nd, 2002, 22:08
Originally posted by mesman00
hey doom, what program are u the author of? can i get a link to ur site, thanks

The Emuation Utility: A great utility that can help you out with sorting and stuff with your roms. It can even tell which emulator supports which game! It can search, zip/unzip roms, etc, and much more! Wanna get it? Get it here (http://pj64utility.emuxhaven.net/) !

flow``
April 22nd, 2002, 22:54
any INI could tell you what works, and there are many programs to compress and decompress files.. i really see no need for any user with half a brain to use it.

mesman00
April 22nd, 2002, 23:47
nice small program, i just took a look at the source, written in vb, nice. i didn't know vb was really used at all in the emulation scene.

Eddy
April 23rd, 2002, 07:36
you are underestimating vb.

mesman00
April 23rd, 2002, 07:55
im fully aware of what i could do, but lets face it, its not as powerful as c++. personally, i like c++ much more. anyways, lets get back on topic.

dark7aura
September 12th, 2011, 02:13
i'll check this out, it sounds promising

icepir8
September 27th, 2011, 12:33
Hi all,

Been awhile but I am working on TR64ogl plugin again. LOL. Just can't seem to let it die in peace.

Gent
September 27th, 2011, 13:38
great news Ice and fantastic to see you http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/6.gif

D1nn
September 28th, 2011, 09:46
Hey Gent sorry to go off-topic but what "Is quisnam rideo risi risum permaneo did non adepto iocus" (in your sig) means?

icepir8
September 28th, 2011, 22:55
He who laughs last did not get the joke?

Gent
September 29th, 2011, 00:54
Ice is spot on :)

D1nn
September 29th, 2011, 11:56
He who laughs last did not get the joke?

Thanks icepir8! I tried google translator but it wasn't exactly spot on.
"BTW" keep up the good work on the plugin:)

p.s Gent that's a cleverly sarcastic smart and amusing quot .... that I heard before. Putting it in Latin though was a great move it gave it a completely different spin.:D

ExtremeDude2
September 29th, 2011, 13:54
This is the bigest bump I have ever seen :P (9years)