Polygon drawing!

In the SGL library there is a function defined

------------

void slWindow(left, top, right, bottom, Zlimit, ctx, cty)

------------

Which allows you to set the clipping area, and determine the screen origin (centerx, centery) of all 3D objects drawn.

Questions.

1. In all SGL demos, there is terrible clipping on all polygons that approach the edge of the screen. If a polygon's vertex goes off the screen, then the SGL will interpolate the coordinates until they are onscreen. The only problem is that this technically alters both the polygon and the distortion, resulting in some horrible texture warp. How can you turn this clipping off? SGL provides functions to set the Z-clip distance and user window clipping, but not to disable it. Whereas the VDP1 does have instructions to disable clipping. Is there an SGL function I'm missing--I haven't gone through the whole Reference, but I have searched it for "clip", "center", and "screen", found nothing like what I was looking for. I don't want to disable all clipping (if a polygon is completely off screen, fine, don't draw it) but I do want to disable the pre-clipping that the SGL tells VDP1 to do. And I know this can be done, but I'm not quite sure how...

Z-clipping is not an issue because that's good stuff. I only want to alter clipping to the projection surface so that only polygons fully beyond the surface rectangle are clipped. SGL Manual Tutorials discuss setting the clipping area with slWindow on pages 78-83 but don't mention how to alter clipping behavior.

2. The User window clipping can only be set twice each frame. This is not an SGL limitation but apparently a VDP1 one (I just figured this stuff out). Thus, slWindow() can only be called twice each frame, and all other calls will fail. But. VDP1 Docs make a clear distinction between changing the User clipping window (VDP1 Manual pg113) and changing the local coordinates of the screen's centerx, centery (pg 117). Thus you can change Local coordinates more than twice during draw. But. There is no SGL command to do this other than slWindow(). ...Is it possible that I could create my own function to post a command to VDP1 that would change this?

So, in a nutshell, if SGL can't help me set this stuff up right, how difficult will it be to manually send the VDP1 a command to do so?
 
VDP1 clipping will simply discard pixels that fall outside the user or system clipping areas. It will not alter the geometry or cause distortions. There is also no limit on how often you set the user or system clipping areas. SGL does all the 3D clipping by itself, in software.

I'm not familiar enough with SGL to solve your problems, but you could try making the clipping area larger than the visible area. Also have a look at the document files included with the library, they are more up-to-date than the PDF manuals.
 
Bloody...well, if I ever manage to recode the SGL's clipping, I'll let you know :)

In any case it might be a good thing if I figured out how to use the SBL6+SGL package, since it has some sources...

Thanks for the info though, it's good to hear the clipping is SGL's fault and not the VDP1. Though I still may try figuring out how to send a Local coordinate change command to VDP1, as I can think of a use or two for that.

EDIT: For examples of this clipping warp, try the SGL sample "driving" and "driving2". Alternatively, play Sega Touring Car Championship. I bet they use SGL...
 
Back
Top