But I specified a subwindow 640 pixels wide by 155 pixels high. And yet the above code draws a big red X that takes up half the window. The subwindow is not in the same mode as the parent window. Must be something wrong in the way I
created the subwindow.
By the way, if I don’t move or resize the subwindow, I don’t need a reshape callback function for it, right?
Well, whether you need a (different) reshape callback depends on other needs as well. By means of the reshape callback we set up the view frustum, which creates our “world”. Everything in it, is drawn; anything out gets clipped out. The default view frustum, if I remember correctly is a -1, 1, -1, 1, -1, 1 cube. So yes, if this frustum is enough for you and you’re not going to change the size of the window, you’re ok.
Also remember that by calling the reshape callback we usually set the viewport to the proper dimensions as well.
And yes, I believe that using a frustum with the analogy 1 unit = 1 pixel is the best solution for bitmaped graphics. Good luck!