Announcement

Collapse
No announcement yet.

Question 2 Of DynamicTexturing

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Question 2 Of DynamicTexturing

    Why am i getting:
    Code:
    General protection fault!
    
    History: UScriptedTexture::execDrawTile <- (DynamicTexture
    Temp3.MyDynamicTexture @ Function Test.DynamicTexture.DrawPixel :
    00DE) <- UObject::ProcessEvent <- (xPlayer Temp3.xPlayer, Function
    Engine.PlayerController.Use) <- UObject::ScriptConsoleExec <- (xPlayer
    Temp3.xPlayer) <- UPlayer::Exec <- UViewport::Exec <-
    UWindowsViewport::Exec <- UInput::ExecInputCommands <-
    UInput::Process <- UEngine::InputEvent <-
    UWindowsViewport::CauseInputEvent <- WM_KEYDOWN <-
    UWindowsViewport::ViewportWndProc <- WWindow::StaticProc <-
    MessagePump <- MainLoop <- FMallocWindows::Free <-
    FMallocWindows::Realloc <- 10910191 0 FArray <- FArray::Realloc <- 0*2 <-
    FMallocWindows::Free
    For:
    Code:
    simulated function DrawFrame()
    {
        local int X,Y;
        //Log("DrawFrame(); Began At    "$Level.TimeSeconds);
        StopWatch(False);
        for(Y=0;Y<PixelY.Length;Y++)
        {
            for(X=0;X<PixelY[0].PixelX.Length;X++)
            {
                Log("DynamicTexture.DrawFrame() Drawing Pixel("$X$","$Y$")",'BreakPoint');
                DrawPixel(X,Y,PixelY[Y].PixelX[X]);
            }
        }
        StopWatch(True);
        //Log("DrawFrame(); Finished At "$Level.TimeSeconds);
    }
    
    function DrawPixel(int X, int Y, color C)
    {
        Log("DynamicTexture.DrawPixel("$X$","$Y$",(R="$C.R$",G="$C.G$"B="$C.B$")) Would have drawn a pixel.",'BreakPoint');
        DrawTile(X,Y,X+1,Y+1,0,0,1,1,PixelTex,C);
    }
    I cant figure it out.. Help

    #2
    You're not supposed to subclass ScriptedTexture. Instead, create a new ScriptedTexture object and assign an Actor to its Client property at runtime. That actor will be able to draw onto the ScriptedTexture, but only from its RenderTexture() event.

    Comment


      #3
      Hmm, im just wondering, why should that make a difference?

      Comment


        #4
        WOAH-- It DID make a difference! and the speed is MUCH(Originally scaned, i timed jsut the for() states, 2 seconds. NOW its less then 0.00) faster! Thx lol

        Comment


          #5
          Remember that logging requires a considerable amount of extra time because stuff needs to be written to the log file. And since rendering takes place in an Actor function anyway, subclassing ScriptedTexture is pointless.

          Comment

          Working...
          X