• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# Can anyone explain this?

## Recommended Posts

screen shot: http://mwill.hypermart.net/q2bspprob.jpg I circled the problem areas. here''s the rendering code:
void BSP_Render(void)
{
int i, j;

glActiveTextureARB(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_2D);

for(i=0;i.number);

if(surface[i].textype&SURF_SKY)
goto skip;
if(surface[i].textype&SURF_WARP)
goto skip;
if(surface[i].textype&SURF_NODRAW)
goto skip;
if(surface[i].textype&SURF_TRANS33)
goto skip;
if(surface[i].textype&SURF_TRANS66)
goto skip;

glBegin(surface[i].mode);
for(j=0;j
And the vertices are cached like this:
(not the whole function do to length)
for(i=0;iplanenum];
int first=face->firstedge;
int	last=face->firstedge+face->numedges;
int usepoly;
float mins[2], maxs[2], start[2];

usepoly=0;
surf->firstpoint=totalpoints;
surf->numpoints=face->numedges;

for(j=first;j0)
{
dedge_t *edge=&dedges[sedge];
dvertex_t *vert=&dvertexes[0];

vertices[totalpoints].v[0]=vert[edge->v[0]].point[0];
vertices[totalpoints].v[1]=vert[edge->v[0]].point[1];
vertices[totalpoints].v[2]=vert[edge->v[0]].point[2];

totalpoints++;
}
else
{
dedge_t *edge=&dedges[-sedge];
dvertex_t *vert=&dvertexes[0];

vertices[totalpoints].v[0]=vert[edge->v[1]].point[0];
vertices[totalpoints].v[1]=vert[edge->v[1]].point[1];
vertices[totalpoints].v[2]=vert[edge->v[1]].point[2];

usepoly++;
totalpoints++;
}
}
}

Can anyone explain why I''m getting shering like that?
Could it be because I''m not doing hidden surface removal?
Thanks.


##### Share on other sites
while I admit to never writing a quake renderer before , I have looked through the code in one before, and it had some really weird polygon issues not too disimilar to what you are showing (it would make sense if you do not have backface culling enabled)... this issue with it was that it used GL_POLYGON throughout, after changing it to GL_TRIANGLE_STRIP (***MUCH FASTER***) and removing every second glvertex call (it really should be using arrays though) it was totally fixed. and looked good too. and ran about 3 times faster.
I doubt this would help though

##### Share on other sites
Thanks for the sugestion.

I''m going to try to switch to arrays soon (it''s only rendering the way it is now for testing).

I fixed the problem by setting the near Z plane to 1.0f rather than 0.001f, and that fixed the problem.

##### Share on other sites
Ok.

I serious suggest you change to triangle strips.

Also, re-work the code so you pre-calculate 3 array sets, one for world data, one for 33% transparentcy, and and one for 66%. having those ifs in the code will slow it down probably to about 10% of what it is capable of, if not slower. then you can order into vis set groups, and hopefully if you use texture arrays (extension), you will be able to draw everything with only a few calls to DrawElements, leaving everything to the driver, and therefor the gpu, if you have one....

• ### Forum Statistics

• Total Topics
627701
• Total Posts
2978711

• 21
• 14
• 12
• 10
• 12