Textdraw problems and FPS drop
#1

Ok, i have been working on a analog speedometer and it was looking good until i tested it.

Problem i have is with a needle textdraw (Single textdraw - Model Preview). To simulate it moving im using OnPlayerUpdate and im destroying and creating that TD each time.

On client side there are multiple problems. First needle is "flickering" and as far as i understand these shall not be happening but it does. (I understand it can not be smooth but even when it does not move its still flickering)

Second and more important problem i noticed is that each time i update needle textdraw there is a FPS drop, and interesting thing is if you are switching to some radio station with long name (For example: Radio los santos) you will notice that station name is acting weird at the moment you update TD...

Please note that i have been using similar (Progress Bar) textdraws under OnPlayerUpdate and i didnt have these problem. Im pretty sure these is caused due to Model Preview.
Reply
#2

Bump and update

pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
#define FILTERSCRIPT

#include <a_samp>
#include <zcmd>
//==============================================================================
//==============================================================================
new PlayerText:TestTD;
new Timer;

public OnFilterScriptInit()
{
    printf("\n \t Textdraw bug demonstration loaded...");
    return 1;
}
public OnFilterScriptExit()
{
    PlayerTextDrawDestroy(0, TestTD);
    PlayerTextDrawDestroy(1, TestTD);
    print("\n \t Textdraw bug demonstration unloaded...");
    return 1;
}

new bool:test;
CMD:test(playerid)
{
    if(test)
    {
        test=false;
        KillTimer(Timer);
        PlayerTextDrawDestroy(playerid, TestTD);
        SendClientMessage(playerid, -1, "Textdraw timer off");
    }
    else
    {
        test=true;
        UpdateTextDraw(playerid);
        Timer = SetTimerEx("UpdateTextDraw", 200, true, "d", playerid);
        SendClientMessage(playerid, -1, "Textdraw timer on");
    }
    return 1;
}

forward UpdateTextDraw(playerid);
public UpdateTextDraw(playerid)
{
    PlayerTextDrawDestroy(playerid, TestTD);

    TestTD = CreatePlayerTextDraw(playerid, 379, 379, "NedleLeft");
    PlayerTextDrawBackgroundColor(playerid,TestTD, 0);
    PlayerTextDrawFont(playerid,TestTD, 5);
    PlayerTextDrawLetterSize(playerid,TestTD, 0.500000, 1.000000);
    PlayerTextDrawColor(playerid,TestTD, -16776961);
    PlayerTextDrawSetOutline(playerid,TestTD, 1);
    PlayerTextDrawSetProportional(playerid,TestTD, 1);
    PlayerTextDrawUseBox(playerid,TestTD, 1);
    PlayerTextDrawBoxColor(playerid,TestTD, 0);
    PlayerTextDrawTextSize(playerid,TestTD, 50.000000, 50.000000);
    PlayerTextDrawSetPreviewModel(playerid, TestTD, 19080);//18647
    PlayerTextDrawSetPreviewRot(playerid, TestTD, 0.000000, 90, 90, 1.000000);
    PlayerTextDrawSetSelectable(playerid,TestTD, 0);
    PlayerTextDrawShow(playerid, TestTD);
    return 1;
}
Turn on some program that displays FPS (fraps, shadowplay, or anything else)

Check your averate FPS, type /test command and look at FPS. Also you will notice textdraw flickering, and if you enter vehicle switch radio stations untill you get to Radio Los Sants (longest radio station name) you will notice text acting weird...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)