void CGraphicsModule::clear() { glClearColor(1.0f, 1.0f, 1.0f, 0.0f); glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE ); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glDepthMask(true); glMatrixMode( GL_PROJECTION ); glLoadIdentity(); glOrtho(0.0f, 1.0f*getWidth(), 1.0f*getHeight(), 0.0f, 0.0f, 1.0f); //glOrtho(0.0f, 1.0f*800, 0.0f, 1.0f*600, -1.0f, 100.0f); //gluPerspective( 45.0f, (GLfloat)800/(GLfloat)600, 1.0f, 100.0f ); //glViewport( 0, 0, 640, 480 ); glDepthMask(false); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); offsetX = 0; offsetY = 0; while ( scissorStack.size() > 0 ) { popScissor(); } }
void WordSuggest::specialDraw() const { // *** BACKGROUND *** if (getStyle()->backgroundColor.a > 0) { // Bind, fill and draw background mpBackground->bind(); mpBackground->getShader()->fillValue("matrix", mFullDrawMatrix); mpBackground->getShader()->fillValue("color", getStyle()->backgroundColor); mpBackground->getShader()->fillValue("alpha", getMultipliedDimmedAlpha()); mpBackground->draw(); } // *** SUGGESTIONS *** if (!mSuggestions.empty()) { // Push scissor to prohibit text simple assets to draw outside of this element pushScissor(mX, mY, mWidth, mHeight); // Draw suggestions for (const std::unique_ptr<TextSimple>& rSuggestion : mSuggestions) { rSuggestion->draw(getStyle()->fontColor, mAlpha); } // Draw thresholds (should be same number as suggestions int count = (int)mSuggestions.size(); for (int i = 0; i < count; i++) { // Get threshold for that suggestion float threshold = mThresholds[i].getValue(); // Only draw necessary stuff if (threshold > 0) { // Calculate matrix glm::mat4 matrix = calculateDrawMatrix( mpLayout->getLayoutWidth(), mpLayout->getLayoutHeight(), mSuggestions[i]->getX() - (mDelta / 2), mY, mSuggestions[i]->getWidth() + mDelta, mHeight); // Draw threshold mpThresholdItem->bind(); mpThresholdItem->getShader()->fillValue("matrix", matrix); mpThresholdItem->getShader()->fillValue("thresholdColor", getStyle()->thresholdColor); mpThresholdItem->getShader()->fillValue("threshold", threshold); mpThresholdItem->getShader()->fillValue("alpha", mAlpha); mpThresholdItem->getShader()->fillValue("orientation", 1.f); // vertical threshold mpThresholdItem->getShader()->fillValue("mask", 0); // mask is always in slot 0 mpThresholdItem->draw(); } } // Draw chosen suggestions for (const auto& rChosenSuggestion : mChosenSuggestions) { rChosenSuggestion.upText->draw(getStyle()->fontColor, rChosenSuggestion.alpha); } popScissor(); } // Draw stuff like highlighting InteractiveElement::specialDraw(); }
void Layer::endClip() { auto ctx = gl::context(); ctx->popBoolState( GL_SCISSOR_TEST ); ctx->popScissor(); }