Author Topic: SGDK 2.1 - OpenGL Support  (Read 295619 times)

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: SGDK 2.1 - OpenGL Support
« Reply #15 on: 2008-03-15, 09:18:11 PM »
I'm very happy to report some unexpected side benefits of converting to OpenGL.  There's a significant performance improvement.  I just created a project in SGDK2.1 (OpenGL/OpenTK) and then loaded the same project into the old DirectX version of SGDK2 (this is not a problem for relatively simple projects with no custom code) and found some interesting results comparing the performance:

4800 8x8-pixel tiles on screen + 500 8x8-pixel sprites active:
   DirectX = 31 fps
   OpenGL = 72 fps

4800 8x8-pixel tiles on screen + 1000 8x8-pixel sprites active:
   DirectX = 25 fps
   OpenGL = 49 fps

So it appears performance is about double or better with OpenGL.

Tanja

  • Clever
  • Fanatic
  • ***
  • Posts: 606
    • View Profile
Re: SGDK 2.1 - OpenGL Support
« Reply #16 on: 2008-03-16, 05:46:13 AM »
wow, good  to hear!  :)

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: SGDK 2.1 - OpenGL Support
« Reply #17 on: 2008-03-16, 07:05:43 AM »
On the down side, I don't think it's going to be straightforward to continue to support DirectX.  OpenGL/OpenTK have a nice mechanism to draw transformed frames by specifying the corners of the output quadrilateral whereas with DirectX I had to use a transformation matrix to draw a transformed frame.  That affects one aspect of the code generator -- it needs to know that frames are constructed using corners instead of matrices.  But I don't think I want to support both mechanisms unless it's really important.  How would folks feel about it if I abandon DirectX support?

Any opinion on this, Tanja?

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Re: SGDK 2.1 - OpenGL Support
« Reply #18 on: 2008-03-16, 09:25:34 AM »
I imagine that almost nobody using SGDK2 just yet is so engrossed in the technical details as to have much of an opinion.  The extent to which DirectX was being used in the previous version is not so extensive as to present itself as problematic if somebody who knew DirectX but not OpenGL used SGDK2.

I'm not sure if the change requires a change in the SGDK2 file format, (seeing as how you say it no longer needs matrices?) but it would be nice to provide an auto-upgrade system from previous file versions.
Edward Dassmesser

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: SGDK 2.1 - OpenGL Support
« Reply #19 on: 2008-03-16, 12:27:58 PM »
No change in file format.  I still use matrices to define how the frame is transformed, but when the code is generated, I convert the frame definitions into corner points using the matrices.  And I think the only parts that need to be upgraded are mainly things that can't be upgraded automatically like custom code that references DirectX objects.  I provided a OpenTK version of the Message code object.  It doesn't work very well yet because OpenTK doesn't do text very well yet, but hopefully soon.  I haven't looked at the other importable objects yet, but I'll provide converted versions of those too.  I think upgrading a project will be as easy as resetting the source code and re-importing the custom objects (or making the necessary tweaks manually in the case of sprite definitions that are referencing DirectInput.Keys).

Tanja

  • Clever
  • Fanatic
  • ***
  • Posts: 606
    • View Profile
Re: SGDK 2.1 - OpenGL Support
« Reply #20 on: 2008-03-18, 08:23:11 AM »
do as you like, and what's the best for sgdk2. this frame-corner thing sounds nice. i think we can change our directX-related rules without too much stress.

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: SGDK 2.1 - OpenGL Support
« Reply #21 on: 2008-05-03, 09:21:12 AM »
Good news: I got full screen support working... at least in my environment -- not sure how it will behave on others' hardware/drivers.  And I think it will be much nicer than DirectX was if you have to debug because it doesn't lock the display.  It just changes the resolution and makes the window take up the whole screen (removing menus and borders).  So if some error happens, you won't be stuck unable to access other programs or debug it.

Now I just need to see if I can get OpenTK to finish the font support so I can fix the word wrapping for message boxes.  Then I'm not aware of any other changes that need to go into the initial OpenTK/GL release before I let it out.  I just wish I knew why the one system can't run any OpenTK-based .NET programs.

Oh, I also upgraded FMODEx to version 4.14.3.  I didn't implement any new features based on this version, and I don't know what new features might be available, but it's better to have a version that is at least still available on the FMOD web site  :-[.

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Re: SGDK 2.1 - OpenGL Support
« Reply #22 on: 2008-05-03, 10:21:58 AM »
Quick question... How is it that DirectX was able to run with non-POT-sized textures while OpenTK cannot on the same system?  Did you take this in to consideration?  Also, have you removed all DX references in the IDE as well?  Or is that still en route?
Edward Dassmesser

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: SGDK 2.1 - OpenGL Support
« Reply #23 on: 2008-05-04, 08:12:09 AM »
Allow me to respond in reverse order.

1) Yes, I have removed all DirectX referenced from the IDE.  I noticed yesterday that I still had a reference to DirectInput and DirectX in the IDE, which surprised me because I thought I had removed all references.  So I removed them and everything was fine.  I guess I removed all the code and just forgot to remove the references :).

2) Maybe the DirectX drivers for the particular card support non-POT-sized textures and the OpenGL drivers report that it doesn't?  That's a good question.  I didn't do any explicit validation of this feature in DirectX -- just tested support for alpha blending I think (which, come to think of it, I haven't done for OpenGL).  I'm gonna have to do some more investigation on this topic.  Too bad I don't have a video card with this problem to do testing with.  I do have a new TV, though... I'll post about that in off topic.

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: SGDK 2.1 - OpenGL Support
« Reply #24 on: 2008-06-06, 06:09:43 AM »
I'm on vacation for a week and a day starting today, and I won't have much web access, so don't expect any replies from me for a week.  But don't worry, I'm still planning to wrap up SGDK 2.1 as soon as the OpenTK library finishes its implementation of text rendering, which is coming up soon, I think (I helped work out one of the issues to move things along).  Meanwhile I'm going to try to get SGDK 2.1 to compile and run under Ubuntu and see how close we are to officially supporting Linux.  The release of 2.1 would be a good time for people to get their work recognized if anyone wants to create super fun little demo games... something like the existing sample project, but longer or more fun perhaps?

Tanja

  • Clever
  • Fanatic
  • ***
  • Posts: 606
    • View Profile
Re: SGDK 2.1 - OpenGL Support
« Reply #25 on: 2008-08-17, 10:54:01 AM »
how is it going on?

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: SGDK 2.1 - OpenGL Support
« Reply #26 on: 2008-08-18, 06:31:00 AM »
I'm still waiting for OpenTK to provide proper font support.

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Re: SGDK 2.1 - OpenGL Support
« Reply #27 on: 2008-08-18, 07:07:06 AM »
Are you making any other changes as far as the requested features list?  Since you're not working on bug fixes, it seems like a good time to do so
Edward Dassmesser

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: SGDK 2.1 - OpenGL Support
« Reply #28 on: 2008-08-18, 05:13:44 PM »
No, I've also been addicted to video games :-[
But I'll see if I can fit some of that in.

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: SGDK 2.1 - OpenGL Support
« Reply #29 on: 2008-09-05, 05:34:17 AM »
Recently I finished fixing the error that occurs when you update a layer's size while the map editor is displayed.  And yesterday I added support for cutting (not just copying) rules and children.  So progress is being made.  If OpenTK doesn't get moving and provide proper font support soon, I may take a suggestion durnurd made and just implement tile-based text drawing (as many games seem to do anyway) to get something out there for 2.1.