To prevent clippinmg, im assuming you can project a texture ontop of alot of triangles, thus stopping it completey... (PSPGL)
Im looking for something like, for each 1 pixel on the PSP screen, i want to have 2 triangles on them... That will stop even 1 pixel from clipping (?)...
So say i have, i dunno, uhh.. 64x64 dimensions for a texture... Id need 64*2 by 64*2 triangles, 2 per pixel, and project that texture ontop of them...
If you know any better way to prevent clipping in PSPGL besides tiling textured quads, instead of texturing a huge quad (my current and best clipping solution), then please tell me as this is bothering me so... OH and i have a camera all set up, gluLookAt is implemented, so if i can change the 'view' values to something else to prevent the clipping from a distance very well, then please tell me..
Projecting whole texture ontop of 100s of triangles? how?
Even subdividing your geometry isn't really going to fix your problem.
When you say 'clipping' you mean 'culling'. The PSP is not rendering your triangles because for some reason it doesn't like them. Either the perspective calculation has gone out of the guard-band, or the z is behind the viewplane (for any individual point).
What can you do?
1) Someone suggested moving your near plane a bit further forwards. Good idea, that will help prevent overflows in the perspective calculation.
2) Enable 2D clipping (scissoring). That means the geometry is clipped to the 480x272 window after the perspective calculation has been done. You will probably still need to near z clip.
3) Enable full 3D clipping. That means a near clip plane and 4 planes defining the view cone.
When you've been turning off clipping and scissoring in PSPGL you're actually turning off the things that can help you.
Either let PSPGL do the clipping, or do it yourself. The clipping is dynamic depending on the camera and you can't pre-compute it.
If you still need to tesselate your geometry, then to get the texture coordinates is simple.
If your original quad has 0->1 for u and 0->1 for v, then if you split each edge 64 times then the u and v are just 0,1/64,2/64,3/64,...
Jim
When you say 'clipping' you mean 'culling'. The PSP is not rendering your triangles because for some reason it doesn't like them. Either the perspective calculation has gone out of the guard-band, or the z is behind the viewplane (for any individual point).
What can you do?
1) Someone suggested moving your near plane a bit further forwards. Good idea, that will help prevent overflows in the perspective calculation.
2) Enable 2D clipping (scissoring). That means the geometry is clipped to the 480x272 window after the perspective calculation has been done. You will probably still need to near z clip.
3) Enable full 3D clipping. That means a near clip plane and 4 planes defining the view cone.
When you've been turning off clipping and scissoring in PSPGL you're actually turning off the things that can help you.
Either let PSPGL do the clipping, or do it yourself. The clipping is dynamic depending on the camera and you can't pre-compute it.
If you still need to tesselate your geometry, then to get the texture coordinates is simple.
If your original quad has 0->1 for u and 0->1 for v, then if you split each edge 64 times then the u and v are just 0,1/64,2/64,3/64,...
Jim
Hmmm... I understand that last part totally... Kind of like setting offsets, and only mapping those offsets as textures... Thats a tad too much work ;) Time to whip out the Red Book ;)
Ill be doing the scissoring technique, but in your opinion, what would you use for a 3d world?
EDIT
Ok, ive found this... Now scissor testing should, as stated in this, only draw whats in the range of the parameters given, so setting ti to the PSPS resolution will prevent culling?
Ill be doing the scissoring technique, but in your opinion, what would you use for a 3d world?
EDIT
Ok, ive found this... Now scissor testing should, as stated in this, only draw whats in the range of the parameters given, so setting ti to the PSPS resolution will prevent culling?
Please correct me if im wrong... (Also, what are your thoughts towards me converting my PSPGL 3d world to the main GU? Since culling isnt a problem there for some reason... Is it worth converting it?)NEHE Tutorial somethin... wrote: A wonderful GL command called glScissor(x,y,w,h). What this command does is creates almost what you would call a window. When GL_SCISSOR_TEST is enabled, the only portion of the screen that you can alter is the portion inside the scissor window. The first line below creates a scissor window starting at 1 on the x axis, and 13.5% (0.135...f) of the way from the bottom of the screen on the y axis. The scissor window will be 638 pixels wide (swidth-2), and 59.7% (0.597...f) of the screen tall.
In the next line we enable scissor testing. Anything we draw OUTSIDE the scissor window will not show up. You could draw a HUGE quad on the screen from 0,0 to 639,480, and you would only see the quad inside the scissor window, the rest of the screen would be unaffected. Very nice command!
You're not making much sense. If you have the Red Book then read it!Hmmm... I understand that last part totally... Kind of like setting offsets, and only mapping those offsets as textures... Thats a tad too much work ;) Time to whip out the Red Book ;)
You set the UVs along with the vertices. You can use a for loop to do it simply.
eg.
Code: Select all
#define STEP (1.0f/64.0f)
float x,y;
for (y = 0; y < 1.0f; y += STEP)
for (x = 0; x < 1.0f; x += STEP)
{
glBegin(GL_QUADS);
glTexCoord2(x,y);
glVertex3f(x,y,0);
glTexCoord2(x+STEP,y);
glVertex3f(x+STEP,y,0);
glTexCoord2(x+STEP,y+STEP);
glVertex3f(x+STEP,y+STEP,0);
glTexCoord2(x,y+STEP);
glVertex3f(x,y+STEP,0);
glEnd();
}
}
If you pick 2D scissoring, you still have the problem of what to do when any of your z coordinates lie behind the near z clip plane (or even when z goes -ve). What are you planning to do then?
3D engines always end up with proper 3D clipping.
No point moving to gu if you can't get GL working. The problems might be better or worse there, but there's nothing fundamentally wrong with GL. You should be able to get it going.
Jim
It's easy to project, you just need to scale your coords into tex space.
Here's a function to change a value from one scale to another.
I.e
float TexU = Scale( VertexX,MapWidth,1 );
float TexV = Scale( VertexY,MapHeight,1 );
you might want to first convert your vertex coord into positive space.
i.e it's from -50,to 50, change it to 0 to 100 first.
Here's a function to change a value from one scale to another.
Code: Select all
float Scale( float val,float from,float to)
{
float sf = val / from;
return to * sf;
}
float TexU = Scale( VertexX,MapWidth,1 );
float TexV = Scale( VertexY,MapHeight,1 );
you might want to first convert your vertex coord into positive space.
i.e it's from -50,to 50, change it to 0 to 100 first.