user6323: I am playing with 3,5" (400x240) TFT display which is placed into Arduino Mega 2560 R3 board.
My final goal is taking .raw data from SD card and drawing it on display.
What I have done so far:
- My drawing method in the sketch:
void LoadImage(File& file)
{
    for (int y = 0; y < SCREEN_HEIGHT && file.available(); y++) {
        uint16_t buf[SCREEN_WIDTH];
        for (int x = SCREEN_WIDTH - 1; x >= 0; x--) {
            byte l = file.read();
            byte h = file.read();
            buf[x] = ((uint16_t)h << 8) | l;
        }
        myGLCD.drawPixelLine(0, y, SCREEN_WIDTH, buf);
    }
}

- For reference drawPixelLine method's implementation from UTFT library:
void UTFT::drawPixelLine(int x, int y, int sx, uint16_t* data)
{
    unsigned int col;
    cbi(P_CS, B_CS);
    setXY(x, y, x+sx-1, y);
    for (int tc=0; tc<sx; tc++)
    {
        char* p = (char*)&data[tc];
        LCD_Write_DATA(*(p + 1), *p);
    }
    sbi(P_CS, B_CS);
}
void UTFT::setXY(word x1, word y1, word x2, word y2)
{
    if (orient==LANDSCAPE)
    {
        swap(word, x1, y1);
        swap(word, x2, y2)
        y1=disp_y_size-y1;
        y2=disp_y_size-y2;
        swap(word, y1, y2)
    }
        LCD_Write_COM(0x2a);
        LCD_Write_DATA(x1>>8);
        LCD_Write_DATA(x1);
        LCD_Write_DATA(x2>>8);
        LCD_Write_DATA(x2);
        LCD_Write_COM(0x2b);
        LCD_Write_DATA(y1>>8);
        LCD_Write_DATA(y1);
        LCD_Write_DATA(y2>>8);
        LCD_Write_DATA(y2);
        LCD_Write_COM(0x2c);                             
}

My current rendering:

Desired image:

TFT Lcd and Mega Board

UPDATE1
I ran henningan test from utft library, drawing sin/cos graph and simple squares

Here is attempt to render yellow square 100x100 raw data


user4359: I'have the same LCD from mcufriend and it doesn't work with original UTFT library.
Try modified version from https://github.com/dgolda/UTFT and use:
myGLCD(NIC35WS,38,39,40,41); //3.5" TFTLCD for arduino 2560 from mcufriend.com


6323: <p>I am playing with 3,5" (400x240) TFT display which is placed into Arduino Mega 2560 R3 board.</p>

<p>My final <em>goal</em> is taking .raw data from SD card and drawing it on display.</p>

<p>What I have done so far:</p>

<p><strong>-</strong> My <strong>drawing</strong> method in the sketch:</p>

<pre><code>void LoadImage(File&amp; file)
{
    for (int y = 0; y &lt; SCREEN_HEIGHT &amp;&amp; file.available(); y++) {
        uint16_t buf[SCREEN_WIDTH];
        for (int x = SCREEN_WIDTH - 1; x &gt;= 0; x--) {
            byte l = file.read();
            byte h = file.read();
            buf[x] = ((uint16_t)h &lt;&lt; 8) | l;
        }
        myGLCD.drawPixelLine(0, y, SCREEN_WIDTH, buf);
    }
}
</code></pre>

<p><strong>-</strong> For reference <strong>drawPixelLine</strong> method's implementation from UTFT library:</p>

<pre><code>void UTFT::drawPixelLine(int x, int y, int sx, uint16_t* data)
{
    unsigned int col;
    cbi(P_CS, B_CS);
    setXY(x, y, x+sx-1, y);
    for (int tc=0; tc&lt;sx; tc++)
    {
        char* p = (char*)&amp;data[tc];
        LCD_Write_DATA(*(p + 1), *p);
    }
    sbi(P_CS, B_CS);
}
void UTFT::setXY(word x1, word y1, word x2, word y2)
{
    if (orient==LANDSCAPE)
    {
        swap(word, x1, y1);
        swap(word, x2, y2)
        y1=disp_y_size-y1;
        y2=disp_y_size-y2;
        swap(word, y1, y2)
    }
        LCD_Write_COM(0x2a);
        LCD_Write_DATA(x1&gt;&gt;8);
        LCD_Write_DATA(x1);
        LCD_Write_DATA(x2&gt;&gt;8);
        LCD_Write_DATA(x2);
        LCD_Write_COM(0x2b);
        LCD_Write_DATA(y1&gt;&gt;8);
        LCD_Write_DATA(y1);
        LCD_Write_DATA(y2&gt;&gt;8);
        LCD_Write_DATA(y2);
        LCD_Write_COM(0x2c);                             
}
</code></pre>

<p><em>My current rendering:</em></p>

<p><img src="https://i.stack.imgur.com/V82Vh.jpg" alt="current result"></p>

<p><em>Desired image:</em></p>

<p><img src="https://i.stack.imgur.com/iVXZg.jpg" alt="enter image description here"></p>

<p><em>TFT Lcd and Mega Board</em>
<img src="https://i.stack.imgur.com/eAa2P.jpg" alt="enter image description here"></p>

<p><strong>UPDATE1</strong></p>

<p>I ran henningan test from utft library, drawing sin/cos graph and simple squares</p>

<p><img src="https://i.stack.imgur.com/5bZe0.jpg" alt="enter image description here"></p>

<p>Here is attempt to render yellow square 100x100 raw data</p>

<p><img src="https://i.stack.imgur.com/F5k4J.jpg" alt="enter image description here"></p>
 4359: <p>I'have the same LCD from mcufriend and it doesn't work with original UTFT library.</p>

<p>Try modified version from <a href="https://github.com/dgolda/UTFT" rel="nofollow">https://github.com/dgolda/UTFT</a> and use:</p>

<pre><code>myGLCD(NIC35WS,38,39,40,41); //3.5" TFTLCD for arduino 2560 from mcufriend.com
</code></pre>
