void Target_keyDown(unsigned int charCode, unsigned int keyCode) { if (charCode == '[') { cycleTextures(-1); } else if (charCode == ']') { cycleTextures(1); } else if (charCode == '{') { cycleAutoBlendModes(-1); } else if (charCode == '}') { cycleAutoBlendModes(1); } else if (charCode == ',') { cycleMinFilters(-1); } else if (charCode == '.') { cycleMinFilters(1); } else if (charCode == '<') { cycleMagFilters(-1); } else if (charCode == '>') { cycleMagFilters(1); } else if (keyCode == KEYBOARD_LEFT_ARROW) { cycleWrapS(-1); } else if (keyCode == KEYBOARD_RIGHT_ARROW) { cycleWrapS(1); } else if (keyCode == KEYBOARD_DOWN_ARROW) { cycleWrapT(-1); } else if (keyCode == KEYBOARD_UP_ARROW) { cycleWrapT(1); } else if (keyCode == KEYBOARD_M) { toggleAutoMipmap(); } else if (keyCode == KEYBOARD_A) { toggleAnisotropy(); } else if (keyCode == KEYBOARD_E) { toggleExtendedTexCoords(); } else if (keyCode == KEYBOARD_B) { toggleBackgroundColor(); } else if (keyCode == KEYBOARD_Z) { toggleZoomLevel(); } else if (keyCode == KEYBOARD_S) { updateTextureImage(); } }
void Target_mouseDown(unsigned int buttonNumber, float x, float y) { if (iPhoneMode) { if (x < viewportHeight / 6) { if (y > viewportHeight - viewportHeight / 6 * 1) { cycleTextures(1); } else if (y > viewportHeight - viewportHeight / 6 * 2) { cycleAutoBlendModes(1); } else if (y > viewportHeight - viewportHeight / 6 * 3) { cycleMinFilters(1); } else if (y > viewportHeight - viewportHeight / 6 * 4) { cycleMagFilters(1); } else if (y > viewportHeight - viewportHeight / 6 * 5) { cycleWrapS(1); } else { cycleWrapT(1); } } else if (x > viewportWidth - viewportHeight / 6) { if (y > viewportHeight - viewportHeight / 6 * 1) { toggleAutoMipmap(); } else if (y > viewportHeight - viewportHeight / 6 * 2) { toggleAnisotropy(); } else if (y > viewportHeight - viewportHeight / 6 * 3) { toggleExtendedTexCoords(); } else if (y > viewportHeight - viewportHeight / 6 * 4) { toggleBackgroundColor(); } else if (y > viewportHeight - viewportHeight / 6 * 5) { toggleZoomLevel(); } else { updateTextureImage(); } } } }
void GLRenderWidget::setupView() { double aspectRatio = (double) width() / (double) height(); glMatrixMode(GL_PROJECTION); // manipulate projection matrix { glLoadIdentity(); GLdouble minx, maxx, miny, maxy, minz, maxz; if(mSpace.isValid) { GLdouble s = sqrt(2); minz = mSpace.maxZ*-s; maxz = mSpace.maxZ*s; minx = mSpace.minX*s; maxx = mSpace.maxX*s; miny = mSpace.minY*s; maxy = mSpace.maxY*s; } else { minx = -80; maxx = 80; miny = -80; maxy = 80; minz = -80; maxz = 80; } // if(mState.equalScale) { GLdouble tmp1 = max(maxx, maxy, maxz); GLdouble tmp2 = min(minx, miny, minz); maxx = tmp1; maxy = tmp1; maxz = tmp1; minx = tmp2; miny = tmp2; minz = tmp2; } minz *= 5; maxz *= 5; if(aspectRatio > 1.0) { // width is greater than height minx *= aspectRatio; maxx *= aspectRatio; } else { miny *= aspectRatio; maxy *= aspectRatio; } glOrtho(minx, maxx, miny, maxy, minz, maxz); if(!mPausePlayback) { glRotatef(mCam.xAngle, 1, 0, 0); glRotatef(mCam.yAngle, 0, 1, 0); glTranslatef(mCam.x, mCam.y, mCam.z); } } toggleBackgroundColor(mActionInvertBackground->isChecked()); }