Anoying clipping problems

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
bumper
Posts: 10
Joined: Thu Oct 06, 2005 5:39 am

Anoying clipping problems

Post by bumper »

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?
jsgf
Posts: 254
Joined: Tue Jul 12, 2005 11:02 am
Contact:

Re: Anoying clipping problems

Post by jsgf »

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.
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.
holger
Posts: 204
Joined: Thu Aug 18, 2005 10:57 am

Re: Anoying clipping problems

Post by holger »

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.
bumper
Posts: 10
Joined: Thu Oct 06, 2005 5:39 am

Post by bumper »

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)
holger
Posts: 204
Joined: Thu Aug 18, 2005 10:57 am

Post by holger »

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.
CyberBill
Posts: 86
Joined: Tue Jul 26, 2005 3:53 pm
Location: Redmond, WA

Post by CyberBill »

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.
Post Reply