gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Beginners > OpenGL and the DS

#138379 - Kiz - Thu Aug 23, 2007 12:51 pm

Hey guys,

Given that Quake (which uses OpenGL) has been ported to the DS, I know that it can at least do *some* OpenGL stuff. Where does it stop though? What version of OpenGL has the homebrew scene managed to get working on it? Are there any specific limitations (certain functions that just don't work, outside of being restricted by versions)?

I'm assuming that any form of pixel shading is just not gonna happen.

I'm doing my second semester of OpenGL (using GLUT/SDL for windowing) at the moment, and am quite familiar with C, so I'm just curious as to how feasible it'd be to port over some of my work to the DS. I've tried searching these forums and googling, but can't find a really solid source of information about OpenGL on the DS, though perhaps I'm just looking for the wrong thing.

Any help or links to good resources would be greatly appreciated.

#138381 - kusma - Thu Aug 23, 2007 1:38 pm

There is no OpenGL on the DS, but the DS GPU has some GL-alike functionality, which for homebrew at least is arranged in a GL-alike API. However, you will never get even OpenGL 1.0 support. Ever.

Porting between OpenGL and DS is perfectly possible, but I recommend that you do that at a higher level than the actual OpenGL-code. Make your own wrapper, exposing the common subset of what the APIs offer and what you need.

#138383 - Kiz - Thu Aug 23, 2007 2:00 pm

Aah ok, thanks heaps for the info. Are there any documents covering the homebrew API's functionality that I should be reading over? All of the homebrew/DS programming tutorials I've glanced over have dealt with graphics using sprites, and stuff that doesn't even remotely resemble any of the OpenGL stuff that I've done.

And while it may sound like a newbish sort of question, I suppose this is the sub-forum to ask it. What exactly do you mean by a wrapper? I've heard the term a thousand times, but don't know exactly what it refers to. Do you mean writing a bunch of my own functions which 'emulate' some of the more advanced functionality by just making a bunch of the regular homebrewGL calls as needed, or am I way off track?

Thanks again.

#138386 - kusma - Thu Aug 23, 2007 2:30 pm

Kiz wrote:
Aah ok, thanks heaps for the info. Are there any documents covering the homebrew API's functionality that I should be reading over?


Here's the header file for the GL-alike API:
http://devkitpro.cvs.sourceforge.net/devkitpro/libnds/include/nds/arm9/videoGL.h?view=markup

And here's some examples:
http://devkitpro.cvs.sourceforge.net/devkitpro/examples/nds/Graphics/3D/

Kiz wrote:
What exactly do you mean by a wrapper?

A wrapper is a bit fluffy term. It usually means some code that hides the complexity of a given system without loosing too much of it's functionality. In the context I used it, I was intending something like this:

Code:

namespace renderer
{
   class Mesh;
   class Device
   {
      void setWorldMatrix(math::Matrix4x4 mat) = 0;
      void setViewMatrix(math::Matrix4x4 mat) = 0;
      void drawMesh(Mesh *m) = 0;
   }
}


extremely over-simplified, but yeah...

#138388 - Kiz - Thu Aug 23, 2007 2:43 pm

Thanks a bunch for the links, reading through some of the examples now. This is exactly what I was looking for.