 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
PosX100
Joined: 15 Aug 2007 Posts: 98
|
Posted: Mon Apr 28, 2008 12:00 am Post subject: GU(ru's needed) related |
|
|
(lame title , i know :) )
Im trying to add 2d support(for panels/menu..etc) in my simple 3d app(its more like a demo atm),but im not sure how to change the projection.
In opengl , im doing it like this:
| Code: |
// Renderer.cpp
inline static void renderMode(const RendererData& r)
{
switch(r.renderer)
{
case RENDERER_OPENGL :
{
glViewport(0, 0, r.getWidth(), r.getHeight());
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if(r.getRenderMode()==RENDER_MODE_2D)
glOrtho( 0, r.getWidth(),r.getHeight(), 0, -1, 1 );
else
gluPerspective(r.getFov(), r.getAspectRatio(), r.getNear(), r.getFar());
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
return;
}
case RENDERER_PSPGU :
{
// -___________________-
return;
}
}
}
}
|
Could you help me out so i can add GU support?
Thanks. |
|
| Back to top |
|
 |
quadrizo
Joined: 23 Aug 2007 Posts: 21
|
Posted: Mon Apr 28, 2008 1:32 am Post subject: |
|
|
you don't need to give a specific ortho projection with GU :
when you use sceGuDrawArray to display yours vertices, give the GU_TRANSFORM_2D parameter: all 3d matrices (rotation, project,...) will not be take in account |
|
| Back to top |
|
 |
Insert_witty_name
Joined: 10 May 2006 Posts: 376
|
Posted: Mon Apr 28, 2008 3:40 am Post subject: |
|
|
As quadrizo mentioned, if you're passing GU_TRANSFORM_2D then you don't need to do anything.
If you are wanting an ortho projection then you would do something like this:
| Code: | // 3D drawing.
sceGumMatrixMode(GU_PROJECTION);
sceGumLoadIdentity();
sceGumOrtho(0.0f, 480.0f, 272.0f, 0.0f, -1.0f, 1.0f);
sceGumMatrixMode(GU_VIEW);
sceGumLoadIdentity();
sceGumMatrixMode(GU_MODEL);
sceGumLoadIdentity();
// Ortho drawing. |
|
|
| Back to top |
|
 |
PosX100
Joined: 15 Aug 2007 Posts: 98
|
Posted: Mon Apr 28, 2008 10:45 pm Post subject: |
|
|
| I see. thanks both for helping me out ! |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|