Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: Bluescreen when using Pixels[x,y,0];

  1. #11

    Bluescreen when using Pixels[x,y,0];

    Greetings! I've re-checked pixel code and it seems fine.

    Open "Plasma" example and change the "TimerRender" function to the following:

    [pascal]procedure TMainForm.TimerRender(Sender: TObject);
    var
    i, j: Integer;
    begin
    with PowerDraw.Device do
    begin
    Clear($FFFF0000);
    BeginScene();

    for j:= 0 to Images[0].TextureHeight - 1 do
    for i:= 0 to Images[0].TextureWidth - 1 do
    Images[0].Pixels[i, j, 0]:= Images[0].Pixels[i, j, 0] and $FFFF0000;

    for j:= 0 to (PowerDraw.Height div 256) do
    for i:= 0 to (PowerDraw.Width div 256) do
    RenderEffect(Images[0], (i * 256), (j * 256), 0, effectNone);

    Fonts[0].TextOut('FPS: ' + IntToStr(Timer.FrameRate), 4, 4, $FFFFFFFF, effectNone);

    EndScene();
    Present();
    end;
    end;[/pascal]

    This uses Pixels property to read and write the entire texture. The example above makes Plasma look in red color only. I had no problems running this on ATI Radeon 9000, Nvidia GeForce 2 Go and Nvidia GeForce 2 MX400 (all run WinXP).
    Maybe your problem is driver related? Although since you mentioned a lot of machines, then maybe you are still trying to access pixel outside image's boundaries? Check that your X and Y coordinates do not overpass TextureWidth and TextureHeight (that is, maximum value for X can be TextureWidth - 1, same applies to Y).

    EDIT: I did not understood what you were trying to say related to TAsphyreImage... if you use TPowerDraw component it needs TAsphyreImages component to be asociated with it, otherwise no images will be created. When TAsphyreImages is asociated with TPowerDraw, each image class is created with TPowerDraw.Device.NewImage, which creates and returns an TAsphyreImage class which is compatible with the specific TAsphyreDevice (that is, TAsphyreDevice3 creates TAsphyreImage3 class instance).

  2. #12

    Bluescreen when using Pixels[x,y,0];

    Hello Lifepower,

    thank you very much for your help so far.

    The confusion is complete now :shock:
    Plasma demo works...
    So I don't really know what I am doing wrong.

    So please take a look at the above mentioned single line in your demo. Where is the fault?
    In the beginning I tried to use variable positions, because I needed Pixels for mouse movement, but to find out something more I tried to get a single Pixel at a specific position in a bitmap, so I used position 10,10 from a picture sized 64*64. This point is definately within the picture.

    The fat printed line above in the snap of code I posted lets my computer hang. Does this work on your machine, if you just insert this line in your example?

    Concerning the TAsphyreImage-thing I said. I was a little confused because I did never take a closer look at your code and I did not understand correctly how you architecture works. But with your explanation it is a little bit clearer, so just forget what I said


    EDIT:
    Could you please do me a favour and take one of your samples where you load images from a vtdb. Then insert a line in rendering-process, where you give out the color of a specific pixel using pixels-property.
    It seems that my systems only crash if the graphics have been loaded from vtdb. The sample you just posted creates the image with CreateCustom and I tried an example with loadfromfile, which seems to make no problems, too. But when trying to access pixels when graphic has been loaded from vtdb the system hangs up.
    <a href="http://www.greatgamesexperiment.com/game/Valgard/?utm_source=gge&amp;utm_medium=badge_game"><img border="0" alt="GGE" title="GGE" src="http://static.greatgamesexperiment.com/badge/game/valgard/gge400x56.png"></a>

  3. #13

    Bluescreen when using Pixels[x,y,0];

    Greets... oh well As you requested, I did the same thing with Combustion Demo. Open it and change "TimerRender" function to this:

    [pascal]procedure TMainForm.TimerRender(Sender: TObject);
    var
    i, j, k: Integer;
    begin
    with PowerDraw.Device do
    begin
    Clear($FF000000 or Cardinal(BlendColor(Color2, Color1, Opacity)));

    BeginScene();

    for k:= 0 to Images[imageCombustion].TextureCount - 1 do
    for j:= 0 to Images[imageCombustion].TextureHeight - 1 do
    for i:= 0 to Images[imageCombustion].TextureWidth - 1 do
    Images[imageCombustion].Pixels[i, j, k]:= Images[imageCombustion].Pixels[i, j, k] and $FFFF0000;

    Particles.Render(VScreen1);

    RenderEffect(Images[imagePowerDraw], 80, 160, 0, effectSrcAlpha);
    RenderEffect(Images[imagePowerDraw], 320, 160, 1, effectSrcAlpha);
    FadeScreen();

    FillRect(220, 272, 200, 30, $5F5F5F, effectMultiply);
    Rectangle(220, 272, 200, 30, $3F3F3F, $1F1F1F, effectAdd);

    Fonts[0].TextOut('Frame Rate: ' + IntToStr(Timer.FrameRate) + ' fps', 228, 272, $FF00FF00);
    Fonts[0].TextOut('Particle Count: ' + IntToStr(PCount), 228, 286, $FF9F9F9F);

    EndScene();
    Present();
    end;
    end;[/pascal]

    And yes, this one works too You should see completely red smoke... and I maybe you should check if that image you are trying to access is REALLY there (use Images.Count) and has the REAL size of 64x64 and not 0x0

  4. #14

    Bluescreen when using Pixels[x,y,0];

    Hello Lifepower,

    your sample works, but it does not what I meant.
    You SET pixels, I just want to GET pixels.
    I have sent you a mail with a little sample which does nothing more than:

    - load bitmap from vtdb
    - print bitmap on screen
    - show fps
    - show pixelcolor of pixel[1,1,0]

    This one hangs up!

    If I insert your code to get the picture red, it works!

    So there has to be a difference in GET and SET pixel. My problem only occurs when GETTING pixels.

    And now the confusing thing:
    After changing the picture to red color using pixels[j,i,0] := .... I am able to GET pixels without problems. That's why your samples work because you always manipulate the bitmap by setting pixels.

    Please try out the little sample I sent you to see what I mean, but be aware of a bluescreen, so save all your work before :lol:

    Greetings,
    Dirk
    <a href="http://www.greatgamesexperiment.com/game/Valgard/?utm_source=gge&amp;utm_medium=badge_game"><img border="0" alt="GGE" title="GGE" src="http://static.greatgamesexperiment.com/badge/game/valgard/gge400x56.png"></a>

  5. #15

    Bluescreen when using Pixels[x,y,0];

    Your program was empty and in my example I used to GET and SET pixels (I change the existing pixel!).

  6. #16

    Bluescreen when using Pixels[x,y,0];

    Sorry for the empty project.
    I seem to have forgotten to save before I zipped the source ops:

    In your example you did not render the picture before you use Pixels.
    Try to render it and THEN access Pixels.
    Your example works even on my machine, like every example you gave me :lol:
    But you never did exactly what I do...

    Render Image
    Show PixelColor on screen.

    If I add the rendering to your example it hangs again.
    It seems that after rendering the texture is locked and Pixels can't access it then. I did not look at the code but I have seen the same behaviour once in DelphiX when I forgot to unlock a texture.


    Greets and very much thanks for your patience with me

    EDIT:
    Don't forget to show Framerate on screen. Some computers reboot, on others the program just halts and you can't see this when nothing happens on screen.
    <a href="http://www.greatgamesexperiment.com/game/Valgard/?utm_source=gge&amp;utm_medium=badge_game"><img border="0" alt="GGE" title="GGE" src="http://static.greatgamesexperiment.com/badge/game/valgard/gge400x56.png"></a>

  7. #17

    Bluescreen when using Pixels[x,y,0];

    @Huehnerschaender : What happens when you debug while trying to get the pixel value ? Maybe you can see what's wrong or where it crashes.

  8. #18

    Bluescreen when using Pixels[x,y,0];

    Yeah, I already did this with Lifepower.
    The error occurs after second render cycle (first frame is rendered well) in procedure EndScene->FlushVertexBuffer following line of code:
    if (Failed(VertexBuffer.Lock(0, BufSize * SizeOf(TPGVertex), p, 0))) then
    This is line 1377 in AsphyreDev3.pas

    Lifepower already tried to investigate the situation, but this error does not occur on his PCs so it is hard to find the problem.

    I have 4 of 5 PCs where the little sample program hang up. On his PC it works...

    I think I will upload this little sample code today and post a link here. Maybe we can then find out if I am the only one with these problems (Maybe its my WinXP installation causing the problems).

    Would be nice if you could test this also then and post if the sample runs well on your system or not and maybe your system configuration.

    Greetings,
    Dirk
    <a href="http://www.greatgamesexperiment.com/game/Valgard/?utm_source=gge&amp;utm_medium=badge_game"><img border="0" alt="GGE" title="GGE" src="http://static.greatgamesexperiment.com/badge/game/valgard/gge400x56.png"></a>

Page 2 of 2 FirstFirst 12

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
  •