Stampede you do not understand what the problem is. I know how to do a simple swap of these bits.
The packet size of raw data sent by server is of size 800*600 (size) only. Because the server gets the indices of RGB values. So, your equality is not correct. What I need to do logically, is to store the received packet in a packet of size size * 3 and assign values to it! but assign values to what? R? G? B? I have no idea because the received packet only contains indices of these RGB values. the below function only gave me some mixed colors:
{
bytes.clear();
bytes.resize(size*3*sizeof(unsigned char));
for(int i = 0, j = 0; i < size*3, j < size; i += 3, j++)
{
bytes[i+2] = btmp[i];
}
updateGL();
}
void GlWidget::paintGL()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glDrawPixels(window_width,window_height,GL_BGR,GL_UNSIGNED_BYTE,bytes.constData());
}
void GlWidget::func(QByteArray btmp)
{
bytes.clear();
bytes.resize(size*3*sizeof(unsigned char));
for(int i = 0, j = 0; i < size*3, j < size; i += 3, j++)
{
bytes[i+2] = btmp[i];
}
updateGL();
}
void GlWidget::paintGL()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glDrawPixels(window_width,window_height,GL_BGR,GL_UNSIGNED_BYTE,bytes.constData());
}
To copy to clipboard, switch view to plain text mode
Bookmarks