2 questions, how is allegro putpixel() so fast and how can I do faster vesa stuff

This is a discussion on 2 questions, how is allegro putpixel() so fast and how can I do faster vesa stuff within the C Programming forums, part of the General Programming Boards category; Question # 1 Im working on a vga/svga graphics library and have a few functions finished like, putpixel, Line, Rect, ...

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    140

    2 questions, how is allegro putpixel() so fast and how can I do faster vesa stuff

    Question # 1

    Im working on a vga/svga graphics library and have a few functions finished like, putpixel, Line, Rect, RectFill. Anyway, I decided to compare my librarys putpixel() function to allegro, I tested how many pixels per second each library could do and allegro got like 3 million and mine got about ninety five thousand. I did both of the tests in vga mode 320x200x256. How does allegro do this!!! My only idea is that allegro is faster because it runs under djgpp which is 32 bit and mine runs under borland (dos 16 bit). I would post the source for my putpixel function but Im at school right now so I cant.

    it may have been something like this:

    int VgaPutPixel(unsigned int x, int y, int color)
    {
    x=(320*y)+x;
    asm
    {
    mov bx, 0A000H
    mov es, bx
    mov bx, x
    mov ax, color
    mov [es:bx], ax
    }
    return 0;
    }


    Question # 2

    How can I do faster vesa stuff (bank switching is slooww), is there any way to not use bank switching?

    thanks

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,540
    > How does allegro do this!!!
    D/L the source code and find out

    > How can I do faster vesa stuff (bank switching is slooww), is there any way to not use bank switching?
    I think (note: think) that video memory is also mapped via a 32 bit interface into a large block of the upper 32 bit address space (something like 8 or 16MB). Not only is this faster, it is also linear, so there is no bank switching.

  3. #3
    Registered User
    Join Date
    Sep 2001
    Posts
    140

    cool

    alright, thanks
    Acos is good

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21