I called this function once per frame and it took my FPS from >400 to 33. Why?
sw blt(const PtRect *dstRect, Texture *src, const PtRect *srcRect, RenderDevice::bltFlags flags=RenderDevice::bltDefault)
{
assert(src);
GL_Texture *glsrc = dynamic_cast<GL_Texture*>(src);
if (glsrc == 0)
return -1;
PtRect srcRect2(0, 0, src->width, src->height);
if (srcRect == 0)
srcRect = &srcRect2;
PtRect dstRect2(0, 0, srcRect->makeWidth(), srcRect->makeHeight());
if (dstRect == 0)
dstRect = &dstRect2;
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, *glsrc->getTex());
glBegin( GL_QUADS );
glNormal3f( 0.0f, 0.0f, 1.0f );
for (size_t i=0; i<350; i++)
{
glTexCoord2f( srcRect->left /src->width, srcRect->top/src->height); glVertex2f(dstRect->left, dstRect->top);
glTexCoord2f( srcRect->right/src->width, srcRect->top/src->height); glVertex2f(dstRect->right, dstRect->top);
glTexCoord2f( srcRect->right/src->width, srcRect->bottom/src->height); glVertex2f(dstRect->right, dstRect->bottom);
glTexCoord2f( srcRect->left /src->width, srcRect->bottom/src->height); glVertex2f(dstRect->left, dstRect->bottom);
}
glEnd();
return 0;
}