Hi, I’m about to go mad because of this fu…ing selection buffer. I started a project just when I was learning the beginnings of OpenGL (two months ago or so) and used an orthographic projection. I use the resize code directly from the superbible like this:
void ChangeSize(int w, int h)
{
GLfloat nRange = 300.0f;
// Prevent a divide by zero
if(h == 0)
h = 1;
fAspect = (GLfloat)w/(GLfloat)h;
// Set Viewport to window dimensions
glViewport(0, 0, w, h);
// Reset coordinate system
glMatrixMode(GL_PROJECTION);
So far so good, but know I’m trieing to use selection mode and it is just…
my process function looks like this, but somehow it just doesn’t work. The Quad I’m trieing to hit is in the upper right corner, but whenever I hit the mousebutton in the negativ y plane, really just somewhere there the selection buffer regesters this as a call. Here is my process code:
void ChangeSize(int w, int h)
{
GLfloat nRange = 300.0f;
// Prevent a divide by zero
if(h == 0)
h = 1;
fAspect = (GLfloat)w/(GLfloat)h;
// Set Viewport to window dimensions
glViewport(0, 0, w, h);
// Reset coordinate system
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if (w <= h)
glOrtho (-300, 300, -300*h/w, 300*h/w, -300*2.0f, 300*2.0f);
else
glOrtho (-300*w/h, 300*w/h, -300, 300, -300*2.0f, 300*2.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
PLEASE HELP ME A DUMB NEWBIE!!!
glLoadIdentity();
if (w <= h)
glOrtho (-300, 300, -300*h/w, 300*h/w, -300*2.0f, 300*2.0f);
else
glOrtho (-300*w/h, 300*w/h, -300, 300, -300*2.0f, 300*2.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}