The latter is where I’m going because the former is driving me nuts!
Unless I’m on a completely different page, this shouldn’t too difficult. My current understanding of all this viewport, clipping area, drawing malarky is presently thusly:
under resizeGL(int w, int h)
I edit all my windows and viewing space and all that…
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, this->width(), 0, this->height(), 1, 1);
Then in paintGL() or whatever:
glMatrixMode(GL_MODELVIEW);
and then away you go drawing to your hearts content.
WRONG
All I get is pain and misery.
if I set up my screen as above, everything works, if I set it up -1,1, nothing works. My 2D print function has its own viewport etc setup which has
glOrtho(0, this->width(), 0, this->height(), -1, 1);
This is all copy pasting which is quite dangerous, so now that I’m trying to get everything to work from scratch, nothing works. I’m trying to just have a simply pain function that draws everything in one fell swoop i.e. draw one object, then another on top, then text. I don’t need nor want to faff around with various matricies when I’m drawing. My case is too simple for that, YET nothing works!
If I set -1,1, my text doesnt show, if I set 1,1, my text doesn’t show, however my other objects are drawn perfectly.
WTH! glortho should be simple, with NO 0 z axis transforms at any stage, in any shape or form in my program, to my mind, all that will happen is, if you ask for an object to be drawn, it will be drawn at the 0 location of the Cartesian axis system (which basically totally makes no sense to me since when I set my far and close z axis thingies in glortho to 1,1 I’m able to see all the objects just fine, anyway… and then if you draw something after, it will simply be drawn on top of the previous object like a sticker on a page.
Please let me know if I am indeed crazy and openGL doesn’t work the way in which I described because presently, it’s doing magic under the hood for me.