Results 1 to 7 of 7

Thread: OpenGl and selective drawing

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    All fixed now. Engine seems to run at 600tiles/sec if you update to screen each time. If you dont its somewhere over 55,000 tiles/second on my 1.2ghz su4100 at 45% background cpu usage. Not bad if I may say so myself. Here is a demo program of it all:

    Code:
    program TileSetTest;
    
    uses
        Prometheus_Vid;
    
    var
        TS: TileSet;
        cx: Int64;
        cy: Int64;
        c: Int64;
    
    begin
        PrometheusVid_Start();
        CreateWindow(1280, 600, 32);
        UpdateWindow();
        
        
        TS.LoadFromImageFile('TileData.png');
        TS.SetOffset(2,3);
        TS.SetSpacing(1,1);
        TS.SetTileSize(16,16);
        TS.SetTileTable(140,140);
        Ts.SetTiles(10000);
        Ts.Update();
        
        cx := 0;
        cy := 1;
        c := 0;
        repeat
            cx := cx + 1;
            c := c + 1;
            Ts.DrawTile((cx - 1) * 16, (cy - 1) * 16, c);
            if cx >= Ts.TilesPerRow then
                begin
                    cx := 0;
                    cy := cy + 1;
                end;
        until cy > 500;
        UpdateCanvas();
        readln();
    end.
    The SetTiles() is not actually required but I put it in as a fallback if something like TS.Update fails entirely.

    PS: This uses <~20mb of ram to load a alpha 2739x2264 png tilesheet and draw it along with all other prometheus crap.
    Last edited by code_glitch; 13-02-2011 at 03:34 PM.
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •