 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
bumper
Joined: 06 Oct 2005 Posts: 10
|
Posted: Sat Oct 08, 2005 4:17 am Post subject: Anoying clipping problems |
|
|
Hi all,
I am writing a basic framework for my future psp program and i have lot of clipping problems that I cant sort out :S
I written some matrix functions (i know that they perfectly work because I use them in my windows projects) and my program render a grid 10x10 grid with X, Y, Z colored axis.
It work but some lines of the grid are clipped and I really don't know why.
I disabled depth testing to be sure all my lines are drawn, no difference.
I disabled clip planes and now there is a difference.
When clip planes are disabled, lot of lines are clipped (not appear at all), especially the ones near to the camera.
When clip planes are enabled, only few lines are not rendered (far from the camera).
The near and far plane are respectively 1 and 100 and the grid is 10x10 units so I dont understand why my lines are clipped.
Moreover when the camera is rotation around the grid (using the cube sample code for rotation), some lines appear and disappear during the movement.
1) Anyone know if a bug is hidden in Gu and how to bypass it? how does it clip the geometry? (normally if clip plane is disabled, all my grid lines should appear!)
2) What is PSPGL exactly, a Gu replacement, is it more robust/complete? |
|
| Back to top |
|
 |
jsgf
Joined: 12 Jul 2005 Posts: 254
|
Posted: Sat Oct 08, 2005 8:08 am Post subject: Re: Anoying clipping problems |
|
|
| bumper wrote: | | 1) Anyone know if a bug is hidden in Gu and how to bypass it? how does it clip the geometry? (normally if clip plane is disabled, all my grid lines should appear!) |
It's a bit hard to tell from your description, but it could be cache issues. If you don't flush the CPU cache (or used uncached pointers), the GE will see non-deterministic data.
| Quote: | | 2) What is PSPGL exactly, a Gu replacement, is it more robust/complete? |
PSPGL is an implementation of OpenGL for the PSP. It's a standard 3D graphics API, and a bit higher level than GU (but not much).
The version at http://goop.org/psp/gl is the best one to get started with. It will handle a lot of the PSP-specific things like flushing the cache, etc. |
|
| Back to top |
|
 |
holger
Joined: 18 Aug 2005 Posts: 204
|
Posted: Sat Oct 08, 2005 8:17 pm Post subject: Re: Anoying clipping problems |
|
|
| bumper wrote: |
1) Anyone know if a bug is hidden in Gu and how to bypass it? how does it clip the geometry? (normally if clip plane is disabled, all my grid lines should appear!)
|
Make your Viewing frustum big enough and split big primitives into smaller ones, see http://forums.ps2dev.org/viewtopic.php?t=2961 for an explanation how clipping works, the PSP's clipping algorithm is a bit simplicistic.
| bumper wrote: |
2) What is PSPGL exactly, a Gu replacement, is it more robust/complete? |
pspgl is a OpenGL-alike implementation to allow quick prototyping on the desktop. See e.g. pspgl/test-q3/Makefile for a sample Makefile to get an idea how this can work in a more complex project (type 'make' to build for the PSP, type 'make ARCH=""' to build native for the host).
pspgl comes in two flavors: the SVN tree on svn.pspdev.org, and Jeremy's tree. Jeremy's tree implements color and vertex format conversion as you are used from OpenGL (instead of doing direct DMA from user buffers, which requires that you convert your data in native format). In the SVN tree we're working on dynamic runtime code generation using the Vector FPU for this job, but this still needs some time to get done well. We were talking about moving Jeremy's code into SVN for ease of synchronisation, too - but I don't know when he plans to do the actual move.
All GL libraries for the PSP use the same hardware and thus have the same hardware-limitations. Using OpenGL as API just makes your code more portable. |
|
| Back to top |
|
 |
bumper
Joined: 06 Oct 2005 Posts: 10
|
Posted: Sun Oct 09, 2005 9:41 pm Post subject: |
|
|
Ok thanks, it seems that the 2 points of my lines are offscreen so the line is clipped. Its sad but i can handle it, the grid is just for debug purpose, the real geometry will be far away from the camera so it should be ok.
Is there more features in PSPGL than Gu? (i.e DXTn compression, multitexturing) |
|
| Back to top |
|
 |
holger
Joined: 18 Aug 2005 Posts: 204
|
Posted: Sun Oct 09, 2005 9:55 pm Post subject: |
|
|
DXT compression is supported by both ones, multitexturing is not supported by the hardware.
The libgu is just a very thin wrapper around the GE, it mirrors pretty exactly what the hardware is able to do. pspgl is wrapping this into an OpenGL-API, so that your code becomes portable. |
|
| Back to top |
|
 |
CyberBill
Joined: 26 Jul 2005 Posts: 86 Location: Redmond, WA
|
Posted: Mon Oct 10, 2005 5:21 am Post subject: |
|
|
| bumper wrote: | Ok thanks, it seems that the 2 points of my lines are offscreen so the line is clipped. Its sad but i can handle it, the grid is just for debug purpose, the real geometry will be far away from the camera so it should be ok.
Is there more features in PSPGL than Gu? (i.e DXTn compression, multitexturing) |
Just split up your line into a lot more points than 2 for the grid. The PSP can render (theoretically) ~5 million triangles a second... in my experiences using fully textured & lit verts, we're seeing ~1-2 million a second. So dont worry about performance or anything when using a bigger linelist. |
|
| 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
|