I'm trying to develop a 3D graphics engine, I use a framebuffer
class which is of my own creation but the fps is too low, and I think it's because I use putpixel()
function from winbgim library
,
My function to show framebuffer on screen is:
void framebuffer::showonscreen() //from buffer to screen(space to space 1d to 2d)
{
int i;
for(int y=0; y < length; y++)
{
for(int x=0; x < width; x++)
{
i = x + screeny[y];
putpixel(x, y, colbuf[i]);
}
}
}
Is there any alternative to this putpixel function or a technique to speed it up, or any other manual (without using libraries) way
I heard about giving a direct access to memory blocks, or using the vram
Would any one know how to help me in this problem?
Please don't try to reinvent the wheel, there are nice, open source, cross platform wheels for you to use. You can't really expect to get much performance if you're individually setting each pixel using CPU, it's much nicer to use the GPU, which basically requires you to use the nice, open source, cross platform wheels I was referring you to earlier.