xboxscene.org forums

Author Topic: Software Gl Rendering For Openxdk  (Read 68 times)

d0wnlab

  • Archived User
  • Sr. Member
  • *
  • Posts: 326
Software Gl Rendering For Openxdk
« on: January 13, 2005, 11:27:00 AM »

So.. late last night I was pouring through the mesa source distribution when I found something that I had hoped was there, but wasn't very obvious on their website.

For those who don't know, Mesa is a (in most cases) software OpenGL renderer.

There is a driver called osmesa, whose purpose is to do offscreen rendering to a memory buffer.  It doesn't depend on any environment other than libc.

So.. long story short I got it compiled, and some demo stuff working.  By working I mean _barely_ though, and this is where I appeal for some help.  I can get the core GL stuff working, but so far using GLU to set up my perspective and stuff has resulted in the xbox rebooting on the line glFinish(). (which is required).

If anyone can hack around with this and try to get some of the GLU stuff working, please do.. I will try later next week.  If we can get this working (which shouldn't be that bad since it IS compiling and vanilla GL IS working) we can start porting a huge number of OpenGL games to the XBox.  Personally if glTron gets ported then I'll be happy, and that's sort of my reasoning for trying this.  Again, there is a huge number of open source GL-based games out there.

Keep in mind it's software rendering and it's _bloody_ slow.  The fastest I can get it to go is by passing mesa a pointer to my raw SDL_Surface screen->pixels, to avoid having to reblit after rendering.  It still seems pretty slow, but I was using it at full 640x480 rendering.  In the osdemo.c file you can see the three different attempts I use for blitting and feel free to comment/uncomment any of the 3 to try the different methods.  Basically the methods are:

allocate buffer and create surface from buffer pointer and blit every frame
create surface as SDL_HWSURFACE and set buffer pointer to surface->pixels
point buffer to screen->pixels to avoid blitting every frame.

Anyways the binary library release is at: http://th0mas.sixbit...libMesa-bin.tgz (extract in openxdk root)
the test code I'm using is at: http://th0mas.sixbit...s/test-mesa.tgz (extract wherever, might need to edit makefile)

if anyone wants the mesa source as it stands I can tarball it and post it too.. It's an ugly hack to get it to compile so I'm not posting it until requested smile.gif

Logged

d0wnlab

  • Archived User
  • Sr. Member
  • *
  • Posts: 326
Software Gl Rendering For Openxdk
« Reply #1 on: January 17, 2005, 01:44:00 PM »

Alright.. I had some time to debug what was going on today and figured it out.  Seems like keeping perspective correction off solves the problem I was having.  I have re-released the test-mesa.tgz code (see link in first post) and now GLU works too.  It is set to render at 320x240 directly to the screen framebuffer.  If you want 640x480 you have to change the WIDTH and HEIGHT defines in osdemo.c, and if you want to buffer the renders to then blit back an animation quicker, then you'll have to change the init code to render to a seperate SDL_Surface instead of directly to screen.  It shouldn't be that hard.

Note that when you blit directly to the framebuffer it appears that the blue/red channels are switched.  I'm going to fix this soon.

Software openGL rendering now works for the openXDK!  (it _is_ really slow though)
Logged

JapanFred

  • Archived User
  • Full Member
  • *
  • Posts: 116
Software Gl Rendering For Openxdk
« Reply #2 on: January 17, 2005, 03:48:00 PM »

QUOTE(d0wnlab @ Jan 17 2005, 10:15 PM)
Alright.. I had some time to debug what was going on today and figured it out.  Seems like keeping perspective correction off solves the problem I was having.  I have re-released the test-mesa.tgz code (see link in first post) and now GLU works too.  It is set to render at 320x240 directly to the screen framebuffer.  If you want 640x480 you have to change the WIDTH and HEIGHT defines in osdemo.c, and if you want to buffer the renders to then blit back an animation quicker, then you'll have to change the init code to render to a seperate SDL_Surface instead of directly to screen.  It shouldn't be that hard.

Note that when you blit directly to the framebuffer it appears that the blue/red channels are switched.  I'm going to fix this soon.

Software openGL rendering now works for the openXDK!  (it _is_ really slow though)
*



Grats on getting it to work mate!
Logged

d0wnlab

  • Archived User
  • Sr. Member
  • *
  • Posts: 326
Software Gl Rendering For Openxdk
« Reply #3 on: January 18, 2005, 11:38:00 AM »

beerchug.gif
Logged

JapanFred

  • Archived User
  • Full Member
  • *
  • Posts: 116
Software Gl Rendering For Openxdk
« Reply #4 on: January 18, 2005, 12:37:00 PM »

QUOTE(d0wnlab @ Jan 18 2005, 08:09 PM)
:beer:
*



You deserve a few of them!

Pitty it only seems to be me and you that give a toss about this though :(
Logged

d0wnlab

  • Archived User
  • Sr. Member
  • *
  • Posts: 326
Software Gl Rendering For Openxdk
« Reply #5 on: January 18, 2005, 02:03:00 PM »

well, the more that gets ported and the more stable the core, the larger number of developers that will choose openXDK.  In other words there's still lots to do smile.gif  However I see this being the next generation of XBox development.  You can legally distribute your binaries - that is really powerful!

I'm trying to knock as much off of edwardaux's todo list so he can implement networking when he's back from vacation.

I will however post some demos displaying a cumulation of the libs I've successfully ported, but I want to finish porting a couple more to add into it first.
Logged

nangsyde

  • Archived User
  • Newbie
  • *
  • Posts: 12
Software Gl Rendering For Openxdk
« Reply #6 on: January 19, 2005, 12:45:00 AM »

QUOTE(JapanFred @ Jan 18 2005, 10:02 PM)
Pitty it only seems to be me and you that give a toss about this though :(
*


Hehe, not quite, there are three of us  :)   I'll get the examples compiled up and have a play when I've got some time, good stuff!
Logged