PDA

View Full Version : Drawing partly outside of window and display problems



architekt
05-27-2002, 09:05 PM
I'm trying to do some smooth scrolling for an overhead tile type of game. I sucessfully did it using Allegro a long time ago in DOS and felt like updating things and using OpenGL this time. Here's my problem: I've got an 800x600 window. If I try to start drawing a tile at anything negative (in the X direction, not testing Y yet), the entire tile doesn't show up at all. What I want to have happen, is for just part of the tile to show. So if a tile is 16x16, and instead of being drawn at (0, 32) it now needs to be shoved left by 6 pixels, I would want to start drawing at (-6, 32), and that way only 16-6=10 pixels would ideally wind up showing on the screen. But this is not happening. As soon as I do a glTranslatef(...) with a value less than 0 for the X direction, the entire image doesn't get shown. Here's how I've set up my viewing volume:

glViewport(0, 0,width,height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, width, 0, height, __z_near, __z_far);
glViewport(0,0,width, height);

Is the problem with the viewing volume?

architekt
05-27-2002, 09:48 PM
nevermind. The dangers of coding when really damn tired. The problem was the difference between using an unsigned integer versus a signed one ("OHHHhhh ya, unsigned can't be negative"). At least I caught it =)