Welcome! Log In Create A New Profile

Advanced

Shaders with GX

Posted by Arikado 
Shaders with GX
August 07, 2009 07:52PM
I'm doing a little work with porting a program that uses OpenGL to libogc GX. I've come very far, but now I'm stumped at implementing shader functionality:

OpenGL has the following functions I need to compensate for:

glCreateShader()
glShaderSource()
glCompileShader()
glGetShaderiv()
glGetShaderInfoLog()
glAttachShader()
glDeleteShader()

I don't mind doing a bit of hard work on my own, but looking through gx.h I can't find any functions at all that have anything to do with shaders. Granted, I'm not a 3D programmer nor am I an expert with GX, but I'm fairly certain I'm not overlooking anything obvious.

So what I'm asking is: Is there any shader functionality at all in GX, and if so, where? If not, is there anything else I can use other than GX?

Thanks in advance to any and all responders to my query.

-Arikado

Edit: I've found this in GX: I think it's what I need. (Adjusting a texture's "lightness" is what a shader is anyway)
void GX_InitLightPos(GXLightObj *lit_obj,f32 x,f32 y,f32 z);
void GX_InitLightColor(GXLightObj *lit_obj,GXColor col);
void GX_InitLightDir(GXLightObj *lit_obj,f32 nx,f32 ny,f32 nz);
void GX_LoadLightObj(GXLightObj *lit_obj,u8 lit_id);
void GX_LoadLightObjIdx(u32 litobjidx,u8 litid);
void GX_InitLightDistAttn(GXLightObj *lit_obj,f32 ref_dist,f32 ref_brite,u8 dist_fn);
void GX_InitLightAttn(GXLightObj *lit_obj,f32 a0,f32 a1,f32 a2,f32 k0,f32 k1,f32 k2);
void GX_InitLightAttnA(GXLightObj *lit_obj,f32 a0,f32 a1,f32 a2);
void GX_InitLightAttnK(GXLightObj *lit_obj,f32 k0,f32 k1,f32 k2);
void GX_InitSpecularDirHA(GXLightObj *lit_obj,f32 nx,f32 ny,f32 nz,f32 hx,f32 hy,f32 hz);
void GX_InitSpecularDir(GXLightObj *lit_obj,f32 nx,f32 ny,f32 nz);
void GX_InitLightSpot(GXLightObj *lit_obj,f32 cut_off,u8 spotfn);



Edited 1 time(s). Last edit at 08/08/2009 12:36AM by Arikado.
Re: Shaders with GX
August 09, 2009 02:07AM
(I could be very wrong about this; someone with more knowledge can correct me!)

GX does have hardware accelerated lights (as you've found from those functions), but a shader in OpenGL can also manipulate geometry and individual pixels as well; which I believe GX can't do.

Shader
Re: Shaders with GX
August 09, 2009 05:54PM
Thanks for the information DrTwox

I think it would be safe for me to try and use the light GX stuff as the OpenGL functions I listed above are the only shader functions used by the program I'm trying to port. (Unless those functions can manipulate geometry and individual pixels)



Edited 1 time(s). Last edit at 08/10/2009 05:53PM by Arikado.
Re: Shaders with GX
August 12, 2009 09:05AM
Not sure if this will help you, but ill put some links to stuff I found while working out this "situation".

(Information on the TEV unit, and how to go around the shader problem) < Read ERP's post>
[forum.beyond3d.com]

(Some maths to help you with blending functions)
[www.amnoid.de]

(To me, The Wii's GX is similar to Direct X so here is a tutorial which may look similar for doing multitexturing on the Wii)
[www.gamasutra.com]

(Another Gamasutra on a way how to lay out your shading subsystem for the GC / Wii)
[www.gamasutra.com]

I had some other documents which I found, but I lost them so.. if any of this stuff helps you, will try and look for them. :)
Good luck.
Re: Shaders with GX
August 12, 2009 03:05PM
Thanks a ton, if I come up with anything I'll be sure to post here.
Sorry, only registered users may post in this forum.

Click here to login