New Open GL API Released

This forum is for the posting of new newsposts, and it stores the site's news and comments archives. Only newsposters have access to post new news in here; if you wish to submit news, please post it in the discussion section for your particular topic. We may choose to move it here as a newspost if we find that it's worthy for the front page.
User avatar
PH3NOM
DC Developer
DC Developer
Posts: 574
Joined: Fri Jun 18, 2010 9:29 pm
Has liked: 0
Been liked: 0

New Open GL API Released

Post by PH3NOM » Sat Aug 16, 2014 2:45 pm

Hello everyone, today I announce the public release of the new Open GL API for KOS that I have been working on!

I want to say thank you to those who have been following, and encouraging me along the way.
Also, thank you to the creators and maintainers of KOS, for allowing such things to be possible.

You will need the latest version of KOS for this API, as the API has introduced changes to KOS along the way.

You can get the library here:
http://sourceforge.net/p/cadcdev/libgl/ci/master/tree/

And the example code here:
http://sourceforge.net/p/cadcdev/kallis ... mcast/kgl/

Initially, my plan was to create a faster implementation of the API, and a better Z clipping mechanism.
That has certainly been accomplished, every vertex here is being run through my Z clipping algorithm:
Image

However, I realized some more things could be done. I added Dynamic Vertex Lighting:
Image

And Render-To-Texture is also now a part of the API:
Image

Things wouldn't be complete without exposing the use of the PVR's FOG capabilities:
Image

Maybe in the future we will see some 4 player spilt screen 3D homebrew using this API?
Image
Ayla
Insane DCEmu
Insane DCEmu
Posts: 137
Joined: Thu Apr 03, 2008 7:01 am
Has liked: 0
Been liked: 0
Contact:

Re: New Open GL API Released

Post by Ayla » Sat Aug 16, 2014 6:10 pm

Splendid! :D
Jae686
Insane DCEmu
Insane DCEmu
Posts: 112
Joined: Sat Sep 22, 2007 9:43 pm
Location: Braga - Portugal
Has liked: 0
Been liked: 0

Re: New Open GL API Released

Post by Jae686 » Sat Aug 16, 2014 6:24 pm

Excellent.

I will start playing with it tomorrow morning :D

Will a "git pull" be enough to get the API onto the toolchain ?
User avatar
|darc|
DCEmu Webmaster
DCEmu Webmaster
Posts: 16156
Joined: Wed Mar 14, 2001 6:00 pm
Location: New Orleans, LA
Has liked: 16 times
Been liked: 5 times
Contact:

Re: New Open GL API Released

Post by |darc| » Sat Aug 16, 2014 6:27 pm

Looks awesome :D
It's thinking...
User avatar
Neoblast
DC Developer
DC Developer
Posts: 312
Joined: Sat Dec 01, 2007 8:51 am
Has liked: 0
Been liked: 0

Re: New Open GL API Released

Post by Neoblast » Sat Aug 16, 2014 9:00 pm

Awesome.

Thanks again for all the work you've done in this :)

Yes, hopefully something interesting will come out of this...
User avatar
Basil
Insane DCEmu
Insane DCEmu
Posts: 199
Joined: Wed Apr 09, 2008 9:04 am
Has liked: 3 times
Been liked: 0
Contact:

Re: New Open GL API Released

Post by Basil » Sat Aug 16, 2014 9:18 pm

It looks great, thank you!
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5384
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has liked: 1 time
Been liked: 11 times
Contact:

Re: New Open GL API Released

Post by BlueCrab » Sat Aug 16, 2014 9:51 pm

As I've said a number of times while you were working on this, thanks for taking the initiative to make a new GL library for KOS. :grin:

I look forward to seeing what everyone can do with this new tool in the toolbox.
User avatar
DaMadFiddler
Team Screamcast
Team Screamcast
Posts: 7953
Joined: Fri Feb 06, 2004 7:17 am
Location: San Francisco, CA
Has liked: 0
Been liked: 0
Contact:

Re: New Open GL API Released

Post by DaMadFiddler » Sun Aug 17, 2014 1:38 am

Wow, great job! I can't wait to see how this gets put to use.
User avatar
Indiket
DC Developer
DC Developer
Posts: 99
Joined: Sun Sep 05, 2010 5:44 am
Has liked: 0
Been liked: 0

Re: New Open GL API Released

Post by Indiket » Sun Aug 17, 2014 6:05 am

Hey space cats!! :D

First of all, my best congratulations for this great improvement!! Now, I've got some issues to ask you :)

*I can't compile the new GL library. I'm using GCC 4.8.2, Binutils 2.23.2, Newlib 2.0.0. This is the error that console outputs:
SOLVED: GCC 4.8.2 is bugged (performance regressions) and fails to build, so rollback to 4.7.3.

Code: Select all

kos-cc  -c gl-matrix.c -o gl-matrix.o
gl-matrix.c: En la función ‘glhLookAtf2’:
gl-matrix.c:342:1: error: no se puede encontrar un registro para vaciar la clase ‘FP0_REGS’
 }
 ^
gl-matrix.c:342:1: error: este es la insn:
(insn 47 46 48 2 (parallel [
            (set (reg/v:SF 64 fr0 [ __x ])
                (fma:SF (reg:SF 65 fr1 [orig:185 D.3396 ] [185])
                    (reg:SF 69 fr5 [orig:171 forward$1 ] [171])
                    (reg:SF 67 fr3 [orig:228 D.3396 ] [228])))
            (use (reg/v:PSI 151 ))
        ]) gl-matrix.c:294 430 {fmasf4_i}
     (expr_list:REG_DEAD (reg:SF 67 fr3 [orig:228 D.3396 ] [228])
        (nil)))
gl-matrix.c:342: confusión por errores previos, saliendo

* When I compile any game in CPP (using the linker -lstdc++), OpenGL lib throws me this kind of multiple definition errors (at linker time):
FIXED: In commit [4390d6] of libGL.


* SDL file "dc/video/dc_video.c" breaks now the SDL compilation :( . Uncomment "#GL=1" in the base Makefile to see it.
Last edited by Indiket on Sat Aug 23, 2014 11:49 am, edited 11 times in total.
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5384
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has liked: 1 time
Been liked: 11 times
Contact:

Re: New Open GL API Released

Post by BlueCrab » Sun Aug 17, 2014 7:18 am

The internal compiler error is a sign that the compiler you're using is broken in some way. That said, it compiles fine for me on OS X (with the same versions of the compiler and whatnot).

SDL builds fine for me, as well.
Jae686
Insane DCEmu
Insane DCEmu
Posts: 112
Joined: Sat Sep 22, 2007 9:43 pm
Location: Braga - Portugal
Has liked: 0
Been liked: 0

Re: New Open GL API Released

Post by Jae686 » Sun Aug 17, 2014 8:25 am

I am having the same issue

Code: Select all

jaerder@jaerder-G50V ~/development/Tools/dreamcast/kos-ports/libgl $ git pull git://git.code.sf.net/p/cadcdev/libgl master
From git://git.code.sf.net/p/cadcdev/libgl
 * branch            master     -> FETCH_HEAD
Updating efe60e2..aca082f
Fast-forward
 Makefile       |   11 +-
 gl-api.c       | 1358 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 gl-api.h       |  116 +++++
 gl-arrays.c    | 1039 ++++++++++++++++++++++++++++++++++++++++
 gl-arrays.h    |   58 +++
 gl-clip.c      |  745 +++++++++++++++++++++++++++++
 gl-clip.h      |   44 ++
 gl-fog.c       |  102 ++++
 gl-light.c     |  562 ++++++++++++++++++++++
 gl-light.h     |   51 ++
 gl-matrix.c    |  395 ++++++++++++++++
 gl-pvr.c       |  215 +++++++++
 gl-pvr.h       |   54 +++
 gl-rgb.c       |  116 +++++
 gl-rgb.h       |   63 +++
 gl-sh4-light.S |  232 +++++++++
 gl-sh4.h       |   52 ++
 glblend.c      |   77 ---
 glclip.h       |   96 ----
 gldepth.c      |   72 ---
 gldraw.c       |  663 --------------------------
 glfog.c        |  178 -------
 glinternal.h   |  165 -------
 glkos.c        |  210 ---------
 gllight.c      |   27 --
 glmacros.h     |   19 -
 glmisc.c       |  230 ---------
 glmodifier.c   |  212 ---------
 glnzclip.c     |  182 -------
 gltex.c        |  188 --------
 gltrans.c      |  518 --------------------
 glvars.c       |  101 ----
 include/gl.h   |  941 ++++++++++++++++++++-----------------
 include/glu.h  |   67 ++-
 include/glut.h |   25 +
 35 files changed, 5794 insertions(+), 3390 deletions(-)
 create mode 100755 gl-api.c
 create mode 100755 gl-api.h
 create mode 100755 gl-arrays.c
 create mode 100755 gl-arrays.h
 create mode 100755 gl-clip.c
 create mode 100755 gl-clip.h
 create mode 100755 gl-fog.c
 create mode 100755 gl-light.c
 create mode 100755 gl-light.h
 create mode 100755 gl-matrix.c
 create mode 100755 gl-pvr.c
 create mode 100755 gl-pvr.h
 create mode 100755 gl-rgb.c
 create mode 100755 gl-rgb.h
 create mode 100755 gl-sh4-light.S
 create mode 100755 gl-sh4.h
 delete mode 100644 glblend.c
 delete mode 100644 glclip.h
 delete mode 100644 gldepth.c
 delete mode 100644 gldraw.c
 delete mode 100644 glfog.c
 delete mode 100644 glinternal.h
 delete mode 100644 glkos.c
 delete mode 100644 gllight.c
 delete mode 100644 glmacros.h
 delete mode 100644 glmisc.c
 delete mode 100644 glmodifier.c
 delete mode 100644 glnzclip.c
 delete mode 100644 gltex.c
 delete mode 100644 gltrans.c
 delete mode 100644 glvars.c
 mode change 100644 => 100755 include/gl.h
 mode change 100644 => 100755 include/glu.h
 create mode 100755 include/glut.h
jaerder@jaerder-G50V ~/development/Tools/dreamcast/kos-ports/libgl $ ls
gl-api.c     gl-clip.h  gl-light.c    glnzclip.o  gl-sh4-light.S  Makefile
gl-api.h     gldepth.o  gl-light.h    gl-pvr.c    gltex.o
gl-arrays.c  gldraw.o   gllight.o     gl-pvr.h    gltrans.o
gl-arrays.h  gl-fog.c   gl-matrix.c   gl-rgb.c    glvars.o
glblend.o    glfog.o    glmisc.o      gl-rgb.h    include
gl-clip.c    glkos.o    glmodifier.o  gl-sh4.h    kos
jaerder@jaerder-G50V ~/development/Tools/dreamcast/kos-ports/libgl $ source ../../environ.sh 
jaerder@jaerder-G50V ~/development/Tools/dreamcast/kos-ports/libgl $ make
rm -f ../include/GL
ln -s ../libgl/include ../include/GL
kos-cc  -c gl-rgb.c -o gl-rgb.o
kos-cc  -c gl-fog.c -o gl-fog.o
kos-as gl-sh4-light.S -o gl-sh4-light.o
kos-cc  -c gl-light.c -o gl-light.o
kos-cc  -c gl-clip.c -o gl-clip.o
kos-cc  -c gl-pvr.c -o gl-pvr.o
kos-cc  -c gl-arrays.c -o gl-arrays.o
kos-cc  -c gl-matrix.c -o gl-matrix.o
gl-matrix.c: In function ‘glhLookAtf2’:
gl-matrix.c:342:1: error: unable to find a register to spill in class ‘FP0_REGS’
 }
 ^
gl-matrix.c:342:1: error: this is the insn:
(insn 47 46 48 2 (parallel [
            (set (reg/v:SF 64 fr0 [ __x ])
                (fma:SF (reg:SF 65 fr1 [orig:185 D.3396 ] [185])
                    (reg:SF 69 fr5 [orig:171 forward$1 ] [171])
                    (reg:SF 67 fr3 [orig:228 D.3396 ] [228])))
            (use (reg/v:PSI 151 ))
        ]) gl-matrix.c:294 430 {fmasf4_i}
     (expr_list:REG_DEAD (reg:SF 67 fr3 [orig:228 D.3396 ] [228])
        (nil)))
gl-matrix.c:342: confused by earlier errors, bailing out
make: *** [gl-matrix.o] Error 1
jaerder@jaerder-G50V ~/development/Tools/dreamcast/kos-ports/libgl $ 
I should probably re-built the toolchain with a newer compiler...
User avatar
Indiket
DC Developer
DC Developer
Posts: 99
Joined: Sun Sep 05, 2010 5:44 am
Has liked: 0
Been liked: 0

Re: New Open GL API Released

Post by Indiket » Sun Aug 17, 2014 10:18 am

Jae686, I've just re-built the toolchain with GCC 4.7.3 and now compiles fines, so yeah, a nasty GCC bug.

I'm still having the second issue with C++ programs, anyone has a clue about it?
Jae686
Insane DCEmu
Insane DCEmu
Posts: 112
Joined: Sat Sep 22, 2007 9:43 pm
Location: Braga - Portugal
Has liked: 0
Been liked: 0

Re: New Open GL API Released

Post by Jae686 » Sun Aug 17, 2014 10:41 am

Indiket wrote:Jae686, I've just re-built the toolchain with GCC 4.7.3 and now compiles fines, so yeah, a nasty GCC bug.

I'm still having the second issue with C++ programs, anyone has a clue about it?
You are right, I just did the same thing and it compiled fine.

About C++, I have no idea.

The specular example did not compile due to the .c calling "Font.h" and the file being "font.h".

Now only some modem related examples wont compile with :

Code: Select all

make[2]: Entering directory `/home/jaerder/development/Tools/dreamcast/kallistios/examples/dreamcast/modem/basic'
rm -f example1.elf romdisk.*
kos-cc  -c example1.c -o example1.o
kos-cc -o example1.elf example1.o
/home/jaerder/development/Tools/dreamcast/kallistios/lib/dreamcast/libkallisti.a(modem.o): In function `modemCreateCInfoFromPS':
/home/jaerder/development/Tools/dreamcast/kallistios/kernel/arch/dreamcast/hardware/modem/modem.c:123: undefined reference to `_speedCodeToBPS'
/home/jaerder/development/Tools/dreamcast/kallistios/lib/dreamcast/libkallisti.a(modem.o): In function `modemCreateCInfoFromCC':
/home/jaerder/development/Tools/dreamcast/kallistios/kernel/arch/dreamcast/hardware/modem/modem.c:190: undefined reference to `_speedCodeToBPS'
/home/jaerder/development/Tools/dreamcast/kallistios/lib/dreamcast/libkallisti.a(modem.o): In function `modemSelfTest':
/home/jaerder/development/Tools/dreamcast/kallistios/kernel/arch/dreamcast/hardware/modem/modem.c:422: undefined reference to `_verifyControllerData'
/home/jaerder/development/Tools/dreamcast/kallistios/kernel/arch/dreamcast/hardware/modem/modem.c:422: undefined reference to `_verifyDSPData'
collect2: error: ld returned 1 exit status
make[2]: *** [example1.elf] Error 1
make[2]: Leaving directory `/home/jaerder/development/Tools/dreamcast/kallistios/examples/dreamcast/modem/basic'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/jaerder/development/Tools/dreamcast/kallistios/examples/dreamcast/modem'
/bin/sh: 1: exit: Illegal number: -1
make: *** [all] Error 2
Last edited by Jae686 on Sun Aug 17, 2014 11:13 am, edited 1 time in total.
User avatar
Indiket
DC Developer
DC Developer
Posts: 99
Joined: Sun Sep 05, 2010 5:44 am
Has liked: 0
Been liked: 0

Re: New Open GL API Released

Post by Indiket » Sun Aug 17, 2014 11:10 am

BlueCrab, about SDL issue, there's an option to build SDL with OpenGL support. You have to change this at "SDL/base/Makefile":

Code: Select all

# This controls GL support, uncomment for GL support using BERO's libgl (not KGL)
GL=1
Please, can you uncomment this and try to compile it? :)

Jae686: I compiled OK the modem examples: did you check that the new PPP library has been compiled and added into your libs folder?
User avatar
bogglez
Moderator
Moderator
Posts: 576
Joined: Sun Apr 20, 2014 9:45 am
Has liked: 0
Been liked: 0

Re: New Open GL API Released

Post by bogglez » Sun Aug 17, 2014 11:26 am

Congratulations and thanks for the work!
Unfortunately I'm too busy to play around with this right now, but I will try to once I have more free time. It also really makes me want to dev on the DC instead of in an emulator.. I will have to figure out where to get cables and such :-)
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream
dreammatrix
DCEmu Cool Newbie
DCEmu Cool Newbie
Posts: 14
Joined: Fri Sep 30, 2005 5:07 am
Has liked: 0
Been liked: 0

Re: New Open GL API Released

Post by dreammatrix » Sun Aug 17, 2014 11:41 am

Good job Ph3nom ! This looks promising!
Can´t wait for new games or ports using your api !
Thank you very much!
Jae686
Insane DCEmu
Insane DCEmu
Posts: 112
Joined: Sat Sep 22, 2007 9:43 pm
Location: Braga - Portugal
Has liked: 0
Been liked: 0

Re: New Open GL API Released

Post by Jae686 » Sun Aug 17, 2014 12:14 pm

Indiket wrote:BlueCrab, about SDL issue, there's an option to build SDL with OpenGL support. You have to change this at "SDL/base/Makefile":

Code: Select all

# This controls GL support, uncomment for GL support using BERO's libgl (not KGL)
GL=1
Please, can you uncomment this and try to compile it? :)

Jae686: I compiled OK the modem examples: did you check that the new PPP library has been compiled and added into your libs folder?
I did a fresh install of the toolchain...
User avatar
Juan
DCEmu Commie
DCEmu Commie
Posts: 3331
Joined: Sun Jun 15, 2003 11:47 pm
Location: Montevideo
Has liked: 4 times
Been liked: 0

Re: New Open GL API Released

Post by Juan » Sun Aug 17, 2014 3:50 pm

Congrats on the public release!
User avatar
PH3NOM
DC Developer
DC Developer
Posts: 574
Joined: Fri Jun 18, 2010 9:29 pm
Has liked: 0
Been liked: 0

Re: New Open GL API Released

Post by PH3NOM » Sun Aug 17, 2014 5:22 pm

Indiket wrote:Jae686, I've just re-built the toolchain with GCC 4.7.3 and now compiles fines, so yeah, a nasty GCC bug.

I'm still having the second issue with C++ programs, anyone has a clue about it?
Hey there Indi.
Thanks for mentioning c++. I just now realized there is an example in kos dreamcast/cpp/gltest.

I updated the kos cpp gl example to use the new GL API.
http://sourceforge.net/p/cadcdev/kallis ... mcast/cpp/

I did not have a problem with glVertex3f undefined as you did.
I did see 1 problem with the API that is now fixed as of my latest commit, the only file changed was glut.h:
http://sourceforge.net/p/cadcdev/libgl/ ... ude/glut.h

Can you update your glut.h, download that gl c++ example, and let me know your results?
Jae686 wrote:The specular example did not compile due to the .c calling "Font.h" and the file being "font.h".
Thank you for pointing that out, as Im on windows file and folder names are not case sensitive. I have fixed that in the latest commit :lol:
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5384
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has liked: 1 time
Been liked: 11 times
Contact:

Re: New Open GL API Released

Post by BlueCrab » Sun Aug 17, 2014 5:33 pm

I'm not sure what is up with the modem example there... I'll look into it when I get a chance to fire up my laptop and look. Of course, that's somewhat unrelated to the topic at hand here. ;)

With regard to SDL, I won't be able to test anything on an actual Dreamcast for the next week or so, so feel free to try it out and let the rest of us know if it works. :)


Sent from my iPhone using Tapatalk
Post Reply