Off by one bug in CVideoNull::checkPrimitiveCount ??

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
Himi
Posts: 1
Joined: Sat Apr 10, 2004 4:53 am

Off by one bug in CVideoNull::checkPrimitiveCount ??

Post by Himi »

Not sure if this is a bug or not. I was playing with the terraindemo from zenprogramming and was getting Could not draw triangles, too many vertices error.

I checked in the debugger and found that the vtxCount is 65536 and getMaximalPrimitiveCount is 65535

changing
if (vtxCount > m)
to
if ((vtxCount-1) > m)

fixes the issue and the water height renders correctly also.

line 716 in CVideoNull.cpp

bool CVideoNull::checkPrimitiveCount(s32 vtxCount)
{
s32 m = getMaximalPrimitiveCount();
if (vtxCount > m)
{
char tmp[1024];
sprintf(tmp,"Could not draw triangles, too many vertices(%d), maxium is %d.", vtxCount, m);
os::Printer::log(tmp, ELL_ERROR);
return false;
}

return true;
}

I got this error on My ATI 9600 using EDT_OPENGL and EDT_DIRECTX8 in createDevice but not EDT_DIRECTX9

on my Nvidia machine it happens in all modes.

kinda new at this so if someone can confirm that would be great :D
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Ah, ok, my error. I never use that much vertices per buffer, so I did never get that problem. Thanks for posting. :)
Post Reply