GP2X Gpu940 Within Sdl


MattPurland

Still Fresh
Joined
Jun 26, 2006
Messages
38
Is it possible to use gpu940 within and SDL program? I'm currently writing an RPG (think FF7 but with 2D charators) and would like to create a 'world map' by using a simple textured sphere.

I've not actually looked at the source yet, but I'm guessing it's not as easy as including the source and using a function :p

Thanks all :)
 
To be honest I wouldn't mind some advice/help about gpu940 as well, i've downloaded the source and been looking at it for a few days but can't get me head around it. Any really simple projects available where I can get the gist of it? The configure / automake scripts in the cvs seem to want to build for the pc target. Maybe i'm just stupid though! :blink:
 
Is it possible to use gpu940 within and SDL program? I'm currently writing an RPG (think FF7 but with 2D charators) and would like to create a 'world map' by using a simple textured sphere.

This will certainly not be easy.

First, that would require a special SDL library where all GLX stuff would be replaced by custom GP2X curses.

Second, we would need to mix RGB and YUV stuff, because gpu940 render in YUV mode. The gp2x hardware can mix both,
but Im not familiar enough (nor at all) with SDL internals to know if it could possibly match the SDL API.

So, until someone who both knows gpu940 and SDL gives us some better advice, I would say : impossible for now.


The configure / automake scripts in the cvs seem to want to build for the pc target. Maybe i'm just stupid though! :blink:

Yes by default it will compile for PC.
source gp2xenv.sh before running configure and before running make, and it should then compile for gp2x.

As for the simple samples : there are 3 simple programs that uses the gpu940 API in samples/, and two simple GL programs that uses the GL API in GL/samples/. I'm writing a doc (in doc/index.html), which is supposed to give some more help, but it's not finished yet (give me one more week).
 
Last edited by a moderator:
nice one, thanks rixed...

i have just found the shell script file entitled "confgp2x" which i did not see before, so basically editing gp2xenv.sh for the appropriate devkit package and installed location, and then executing the confgp2x script configures the source for cross compiling to the arm.

looking forward to seeing those blank sections in the docs getting filled out :)
nice work rixed. this is ace.
 
i have just found the shell script file entitled "confgp2x" which i did not see before, so basically editing gp2xenv.sh for the appropriate devkit package and installed location, and then executing the confgp2x script configures the source for cross compiling to the arm.

This is how it's supposed to be used.
It won't work that cleanly, though. Manually sourcing gp2xenv before calling make seams usefull.
 
Last edited by a moderator:
I also had some difficulties getting the gpu940 running.

Right now I use the gpu940 and load940 from egoboo, and I've made a libgpu940.a that I use in my program.
All I need to do now is include GL/gl.h and GL/glfloat.h and link the library and I can use plain openGL commands.

It might be a nice thing for not-so-low-level-coders if rixed and team would provide us with occasional releases of precomiled load940, gpu940 and the library that you have to link to use it! Sort of like a gpu940-SDK that is intented for people who only want to use it, and not change any source etc.

At least when I tried the gpu940 it was so much efford I almost quit. I bet there are lots of good programmers out there (good enough to make nice homebrew games) but not good enough with compilertools to get the gpu compiled without using the included makefile.
 
STTrife posted on Feb 10 2007 at 11:36 PM said:
It might be a nice thing for not-so-low-level-coders if rixed and team would provide us with occasional releases of precomiled load940, gpu940 and the library that you have to link to use it! Sort of like a gpu940-SDK that is intented for people who only want to use it, and not change any source etc.

You are right, this will be done.
Let me fix another couple of bugs until releasing a version 1 :)
 
Last edited by a moderator:
Damn I can't find any tutorials that explain setting up a camera WITHOUT the glu-calls gluPerspective and GluLookAt (which are not included in the gpu940)
Anyone knows a good link?
 
STTrife:
I just ripped the gluPerspective and gluLookAt code from Mesa.

Here's the code you need, just paste it in your program and add the prototypes to your header file:
http://rafb.net/p/Al0ylc64.html

(Sure, it uses a lot of floating point math, but it works. If anyone writes a fixed-point version of these functions, please let me know/share it!)
 
GameGod posted on Feb 14 2007 at 02:50 AM said:
STTrife:
I just ripped the gluPerspective and gluLookAt code from Mesa.

Here's the code you need, just paste it in your program and add the prototypes to your header file:
http://rafb.net/p/Al0ylc64.html

(Sure, it uses a lot of floating point math, but it works. If anyone writes a fixed-point version of these functions, please let me know/share it!)

Hi GameGod, I tried your supplied link and it doesn't work for me.
Is there another link I can try?

Or perhaps you could email it to me at paul_nicholls AT hotmail DOT com
or post the solution here :)

cheers,
Paul.
 
Last edited by a moderator:
yeah please put it back on the website, cause I was not at home when I read it the first time, so still don't have it!
 
Ok, I'll just post the code here....
:)

Code:
//Mesa's implementation
void gluPerspective(GLfloat fovy, GLfloat ratio, GLfloat near, GLfloat far)
{
	GLfloat top = near * tan(fovy * M_PI/360.0f);
	GLfloat bottom = -top;
	GLfloat right = top * ratio;
	GLfloat left = -right;

	glFrustum(left, right, bottom, top, near, far);
} 

//Mesa's implementation, switched to floats from doubles in a desperate attempt at getting more speed.
void gluLookAt(GLfloat eyex, GLfloat eyey, GLfloat eyez,
	  GLfloat centerx, GLfloat centery, GLfloat centerz,
	  GLfloat upx, GLfloat upy, GLfloat upz)
{
   GLfloat m[16];
   GLfloat x[3], y[3], z[3];
   GLfloat mag;

   /* Make rotation matrix */

   /* Z vector */
   z[0] = eyex - centerx;
   z[1] = eyey - centery;
   z[2] = eyez - centerz;
   mag = sqrt(z[0] * z[0] + z[1] * z[1] + z[2] * z[2]);
   if (mag) {			/* mpichler, 19950515 */
	  z[0] /= mag;
	  z[1] /= mag;
	  z[2] /= mag;
   }

   /* Y vector */
   y[0] = upx;
   y[1] = upy;
   y[2] = upz;

   /* X vector = Y cross Z */
   x[0] = y[1] * z[2] - y[2] * z[1];
   x[1] = -y[0] * z[2] + y[2] * z[0];
   x[2] = y[0] * z[1] - y[1] * z[0];

   /* Recompute Y = Z cross X */
   y[0] = z[1] * x[2] - z[2] * x[1];
   y[1] = -z[0] * x[2] + z[2] * x[0];
   y[2] = z[0] * x[1] - z[1] * x[0];

   /* mpichler, 19950515 */
   /* cross product gives area of parallelogram, which is < 1.0 for
	* non-perpendicular unit-length vectors; so normalize x, y here
	*/

   mag = sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]);
   if (mag) {
	  x[0] /= mag;
	  x[1] /= mag;
	  x[2] /= mag;
   }

   mag = sqrt(y[0] * y[0] + y[1] * y[1] + y[2] * y[2]);
   if (mag) {
	  y[0] /= mag;
	  y[1] /= mag;
	  y[2] /= mag;
   }

#define M(row,col)  m[col*4+row]
   M(0, 0) = x[0];
   M(0, 1) = x[1];
   M(0, 2) = x[2];
   M(0, 3) = 0.0;
   M(1, 0) = y[0];
   M(1, 1) = y[1];
   M(1, 2) = y[2];
   M(1, 3) = 0.0;
   M(2, 0) = z[0];
   M(2, 1) = z[1];
   M(2, 2) = z[2];
   M(2, 3) = 0.0;
   M(3, 0) = 0.0;
   M(3, 1) = 0.0;
   M(3, 2) = 0.0;
   M(3, 3) = 1.0;
#undef M
   glMultMatrixf(m);

   /* Translate Eye to Origin */
   glTranslatef(-eyex, -eyey, -eyez);

}

Alternatively, you can snag the code temporarily here.
 
Back
Top