Laser "flickers" with SDK programming :(

Discussion in 'The Lounge' started by rlbond86, May 15, 2008.

  1. rlbond86

    rlbond86 New Member

    Laser \"flickers\" with SDK programming :(

    Hi, I am trying to use 4 tracks to draw a square using the laser SDK in c++, sort of to understand how different tracks work.
    I have it working, but tracks 1,2,and 3 "flicker", while track 4 stays solid.
    Here is my code:



    Code:<pre>
    FRAMESTRUCTEX f1,f2,f3,f4;
    PTSTRUCT p1[2],p2[2],p3[2],p4[2];
    memset(&f1, 0, sizeof(f1));
    memset(p1, 0, sizeof(p1));
    memset(&f2, 0, sizeof(f2));
    memset(p2, 0, sizeof(p2));
    memset(&f3, 0, sizeof(f3));
    memset(p3, 0, sizeof(p3));
    memset(&f4, 0, sizeof(f4));
    memset(p4, 0, sizeof(p4));

    int zValue = 0;
    int k = -10;


    SetWorkingTracks(1);
    SetWorkingFrame(1);
    p1[0].RGBValue=0;
    p1[0].XCoord = 8000;
    p1[0].YCoord= 8000;
    p1[0].ZCoord = zValue;
    p1[0].FCoord=0;
    p1[0].Status=4096;
    p1[1].RGBValue=RGB(255,255,255);
    p1[1].XCoord = 8000;
    p1[1].YCoord= -8000;
    p1[1].ZCoord = zValue;
    p1[1].FCoord=0;
    p1[1].Status=4096;
    f1.VectorFlag = 1;
    f1.NumPoints = 2;
    f1.ScanRate=k;
    WriteFrameEx(&f1, &p1[0]);
    DisplayFrame(1);


    SetWorkingTracks(2);
    SetWorkingFrame(2);
    p2[0].RGBValue=0;
    p2[0].XCoord = 8000;
    p2[0].YCoord= -8000;
    p2[0].ZCoord = zValue;
    p2[0].FCoord=0;
    p2[0].Status=4096;
    p2[1].RGBValue=RGB(255,255,255);
    p2[1].XCoord =-8000;
    p2[1].YCoord= -8000;
    p2[1].ZCoord = zValue;
    p2[1].FCoord=0;
    p2[1].Status=4096;
    f2.VectorFlag = 1;
    f2.NumPoints = 2;
    f2.ScanRate=k;
    WriteFrameEx(&f2, &p2[0]);
    DisplayFrame(2);


    SetWorkingTracks(4);
    SetWorkingFrame(3);
    p3[0].RGBValue=0;
    p3[0].XCoord = -8000;
    p3[0].YCoord= -8000;
    p3[0].ZCoord = zValue;
    p3[0].FCoord=0;
    p3[0].Status=4096;
    p3[1].RGBValue=RGB(255,255,255);
    p3[1].XCoord = -8000;
    p3[1].YCoord= 8000;
    p3[1].ZCoord = zValue;
    p3[1].FCoord=0;
    p3[1].Status=4096;
    f3.VectorFlag = 1;
    f3.NumPoints = 2;
    f3.ScanRate=k;
    WriteFrameEx(&f3, &p3[0]);
    DisplayFrame(3);


    SetWorkingTracks(8);
    SetWorkingFrame(4);
    p4[0].RGBValue=0;
    p4[0].XCoord = -8000;
    p4[0].YCoord= 8000;
    p4[0].ZCoord = zValue;
    p4[0].FCoord=0;
    p4[0].Status=4096;
    p4[1].RGBValue=RGB(255,255,255);
    p4[1].XCoord = 8000;
    p4[1].YCoord= 8000;
    p4[1].ZCoord = zValue;
    p4[1].FCoord=0;
    p4[1].Status=4096;
    f4.VectorFlag = 1;
    f4.NumPoints = 2;
    f4.ScanRate=k;
    WriteFrameEx(&f4, &p4[0]);
    DisplayFrame(4);


    SetWorkingTracks(15);
    DisplayUpdateEx(1);
    system("PAUSE");
    </pre>

    As you can see it is pretty simple, for the most part I just copied and pasted four times.
    What am I doing wrong and why is it flickering? Thank you :airtoss:
     
  2. miromanowski

    miromanowski New Member

    Same thing is happening for me

    I have a C++ program using the SDK that is doing the same thing. I am using 4 distinct tracks and frames. I am drawing one frame per track. Since the frames were made at 0,0,0 in LD2000 I am loading the frame file and then moving the frames to were I need them using DisplayTransPost. The issue I am having is with text that I am drawing. My application updates information at 10Hz and during each update there are some frames with pre-drawn objects that I need to move around as well as text that needs to be updated. The pre-drawn frames display fine, solid image, no flickering. I am currently drawing 2 strings of text no more than 4 characters each. The first one drawn flickers while the last one stays solid and bright. I am pretty sure I am staying well under the 30000 pps that the laser hardware is supposed to support. Any ideas on why just the first bit of text I draw would flicker while everything else stays solid?
     
    Last edited: Apr 23, 2011

Share This Page