parejasStats::parejasStats(QWidget* parent, const char* name, bool modal, WFlags fl) : parejasStatsDlg(parent,name, modal,fl) { //http://doc.trolltech.com/3.3/tutorial2-05.html estadisticaLayout = new QGridLayout( estadistica ); estadisticaLayout->setAlignment( Qt::AlignTop ); m_canvas = new baseChart( estadistica ); m_canvasView = new QCanvasView( m_canvas, estadistica ); estadisticaLayout->addWidget(m_canvasView, 0, 0); m_canvasView->show(); m_canvas->setMaxX(32 * 5); m_canvas->setMaxY(20); m_canvas->setMargin(20, 20, 30, 25); m_canvas->setTitle ("Estado de la descendencia"); m_canvas->addDataType(Qt::blue, "Total"); m_canvas->addDataType(Qt::green, "Vuelo"); m_canvas->addDataType(Qt::red, "Desaparecidas"); m_canvas->addDataType(Qt::yellow, "Reproducion"); m_canvasView->setVScrollBarMode(QScrollView::AlwaysOff); m_canvasView->setHScrollBarMode(QScrollView::AlwaysOff); m_canvas->resize(estadistica->width(), estadistica->height()); drawElements(); m_canvas->update(); m_canvasView->repaint (); firstResize = true; }
virtual void end() { if (!_indexCache.empty()) { drawElements(_modeCache,_indexCache.size(),&_indexCache.front()); } }
/** draw the map widget */ void CMapWidget::paintEvent(QPaintEvent *ev) { QPainter p(this); CMapZone *zone = viewWidget->getCurrentlyViewedZone(); QColor color = zone->getUseDefaultBackground() ? mapManager->getMapData()->backgroundColor : zone->getBackgroundColor(); p.fillRect(ev->rect(), color); drawGrid(&p); drawElements(&p); mapManager->getCurrentTool()->paint(&p); }
void Gui::setRearImages(unsigned char* rgb, unsigned char* yuyv, unsigned char* dataY, unsigned char* dataU, unsigned char* dataV, unsigned char* classification) { DebugRenderer::renderFPS(rgb, fps); drawElements(rgb, width, height); drawElements(classification, width, height); drawMouse(rearCameraTranslator, rgb, width, height); if (activeWindow == rearClassification || activeWindow == rearRGB) { if (!isMouseOverElement(mouseX, mouseY)) { if (selectedColorName.length() > 0) { handleColorThresholding(dataY, dataU, dataV, rgb, classification); } } else { handleElements(); } } rearRGB->setImage(rgb, true); rearClassification->setImage(classification, true); }
void ZoomPanElement::draw(ApplicationData appData, Graphics graphics) const { Graphics mainGraphics(graphics); RectangleD frame = getFrame(); if(isClippedToFrame()) { mainGraphics.clip(frame); } drawBackground(appData, mainGraphics); drawMain(appData, mainGraphics); graphics.translate(frame.x, frame.y); drawElements(appData, graphics); }
void parejasStats::resizeEvent( QResizeEvent *e ) { if (firstResize) { m_canvas->resize(estadistica->width(), estadistica->height()); firstResize = false; } else m_canvas->resize(m_canvasView->visibleWidth(), m_canvasView->visibleHeight()); drawElements(); m_canvas->update(); m_canvasView->repaint (); }
void draw(Map** level, int xPos, int yPos, int room, Player * chris, Enemy * enemy[20], int * eneNum) { //declare variables int width, height; //intialize variables and srand width = level[room]->width; height = level[room]->height; srand(time(NULL)); //initailize cursor move(yPos, xPos); //call subdrawing functions drawRoom(&yPos, &xPos, width, height); drawElements(level, xPos, yPos, chris, room, width, height, enemy, eneNum); }//end draw
void ExampleView::paintEvent(QPaintEvent* ev) { if (_score) { QPainter p(this); p.setRenderHint(QPainter::Antialiasing, preferences.getBool(PREF_UI_CANVAS_MISC_ANTIALIASEDDRAWING)); p.setRenderHint(QPainter::TextAntialiasing, true); const QRect r(ev->rect()); drawBackground(&p, r); p.setTransform(_matrix); QRectF fr = imatrix.mapRect(QRectF(r)); QRegion r1(r); Page* page = _score->pages().front(); QList<Element*> ell = page->items(fr); qStableSort(ell.begin(), ell.end(), elementLessThan); drawElements(p, ell); } QFrame::paintEvent(ev); }
gl::Error RendererD3D::drawElements(const gl::Data &data, GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instances, const gl::RangeUI &indexRange) { if (data.state->isPrimitiveRestartEnabled()) { UNIMPLEMENTED(); return gl::Error(GL_INVALID_OPERATION, "Primitive restart not implemented"); } gl::Program *program = data.state->getProgram(); ASSERT(program != NULL); program->updateSamplerMapping(); gl::Error error = generateSwizzles(data); if (error.isError()) { return error; } if (!applyPrimitiveType(mode, count, program->usesPointSize())) { return gl::Error(GL_NO_ERROR); } error = applyRenderTarget(data, mode, false); if (error.isError()) { return error; } error = applyState(data, mode); if (error.isError()) { return error; } gl::VertexArray *vao = data.state->getVertexArray(); TranslatedIndexData indexInfo; indexInfo.indexRange = indexRange; SourceIndexData sourceIndexInfo; error = applyIndexBuffer(indices, vao->getElementArrayBuffer().get(), count, mode, type, &indexInfo, &sourceIndexInfo); if (error.isError()) { return error; } applyTransformFeedbackBuffers(*data.state); // Transform feedback is not allowed for DrawElements, this error should have been caught at the API validation // layer. ASSERT(!data.state->isTransformFeedbackActiveUnpaused()); GLsizei vertexCount = indexInfo.indexRange.length() + 1; error = applyVertexBuffer(*data.state, mode, indexInfo.indexRange.start, vertexCount, instances, &sourceIndexInfo); if (error.isError()) { return error; } error = applyShaders(data); if (error.isError()) { return error; } error = applyTextures(data); if (error.isError()) { return error; } error = program->applyUniformBuffers(data); if (error.isError()) { return error; } if (!skipDraw(data, mode)) { error = drawElements(mode, count, type, indices, vao->getElementArrayBuffer().get(), indexInfo, instances, program->usesPointSize()); if (error.isError()) { return error; } } return gl::Error(GL_NO_ERROR); }
void Slide::draw(const Common::Rect &r) { Common::Rect oldBounds, newBounds; adjustSlideRects(oldBounds, newBounds); drawElements(r, oldBounds, newBounds); }
void MadsScene::update() { // Draw all the various elements drawElements(); _action.set(); }
void DrawExecution::perform() { m_glStateManager.enableTextureCubeMapSeamless(true); // Apply State applyDepthState(); applyBlendState(); applyCullState(); applyRasterizerState(); applyStencilState(); applyViewport(); gl::glUseProgram(m_drawImpl.program->glProgramName); // Setup texture units for (auto b = 0u; b < m_drawImpl.samplers.size(); b++) { auto & sampler = m_drawImpl.samplers[b]; auto * texture = sampler.texture; Assert(texture, ""); if (texture->glName == 0) { texture->allocate(); } gl::glActiveTexture(gl::GL_TEXTURE0 + b); gl::glBindTexture(texture->type, texture->glName); gl::glTexParameteri(texture->type, gl::GL_TEXTURE_BASE_LEVEL, texture->baseLevel); gl::glTexParameteri(texture->type, gl::GL_TEXTURE_MAX_LEVEL, texture->maxLevel); gl::glBindSampler(b, sampler.glSampler.name()); gl::glSamplerParameteri(sampler.glSampler.name(), gl::GL_TEXTURE_MIN_FILTER, (gl::GLint)texture->minFilter); gl::glSamplerParameteri(sampler.glSampler.name(), gl::GL_TEXTURE_MAG_FILTER, (gl::GLint)texture->maxFilter); gl::glUniform1i(sampler.location, b); } // Setup RenderTarget / Framebuffer Assert(m_drawImpl.framebuffer.m_impl.get(), ""); m_drawImpl.framebuffer.m_impl->bind(m_glStateManager); // Set uniforms { /* TODO Port to GLStateManager */ for (auto & uniform : m_drawImpl.uniforms) { Assert(uniform.isAssigned, "Uniform " + m_drawImpl.program->interface.uniformByLocation(uniform.location)->name() + " not set"); Assert(uniform.count > 0, ""); auto count = uniform.count; auto * data = uniform.blob.ptr(); auto location = uniform.location; switch (TypeToGLType(uniform.type)) { case gl::GL_INT: gl::glUniform1iv(location, count, ((const gl::GLint*)data)); break; case gl::GL_UNSIGNED_INT: gl::glUniform1uiv(location, count, ((const gl::GLuint*)data)); break; case gl::GL_INT_VEC2: { auto idata = (const gl::GLint*)data; gl::glUniform2iv(location, count, idata); break; } case gl::GL_FLOAT: gl::glUniform1fv(location, count, ((const gl::GLfloat*)data)); break; case gl::GL_FLOAT_VEC2: { auto fdata = (const gl::GLfloat*)data; gl::glUniform2fv(location, count, fdata); break; } case gl::GL_FLOAT_VEC3: { auto fdata = (const gl::GLfloat*)data; gl::glUniform3fv(location, count, fdata); break; } case gl::GL_FLOAT_VEC4: { auto fdata = (const gl::GLfloat*)data; gl::glUniform4fv(location, count, fdata); break; } case gl::GL_FLOAT_MAT4: gl::glUniformMatrix4fv(location, count, gl::GL_FALSE, (const gl::GLfloat*)data); break; default: Fail(std::string("Not implemented for type ") + uniform.type.name()); } } } // Set uniform buffers { for (auto b = 0; b < m_drawImpl.uniformBuffers.size(); b++) { auto & binding = m_drawImpl.uniformBuffers[b]; Assert(binding.engaged(), "UniformBuffer " + m_drawImpl.program->interface.uniformBlocks()[b].name() + " not bound"); auto & buffer = *binding.get().buffer; auto size = buffer.count * buffer.layout.stride(); Assert(size > binding.get().begin, "begin beyond buffer bounds"); gl::glUniformBlockBinding(m_drawImpl.program->glProgramName, b, b); gl::glBindBufferRange(gl::GL_UNIFORM_BUFFER, b, buffer.glName, binding.get().begin, buffer.layout.stride()); } } // Dispatch draw if (m_drawImpl.indexBuffer) { if (!m_drawImpl.instanceBuffers.empty()) { drawElementsInstanced(); } else { drawElements(); } } else { if (!m_drawImpl.instanceBuffers.empty()) { drawArraysInstanced(); } else { drawArrays(); } } }
void swcRectangle::draw() { if (!visible) return; const uint32_t outer_border_vertices[] = { //top radius_top_left.x, -border_size_top, width - radius_top_right.x, -border_size_top, width - radius_top_right.x, 0, radius_top_left.x, 0, //right width, radius_top_right.y, width + border_size_right, radius_top_right.y, width + border_size_right, height - radius_bottom_right.y, width, height - radius_bottom_right.y, //bottom radius_bottom_left.x, height, width - radius_bottom_right.x, height, width - radius_bottom_right.x, height + border_size_bottom, radius_bottom_left.x, height + border_size_bottom, //left -border_size_left, radius_top_left.y, 0, radius_top_left.y, 0, height - radius_bottom_left.y, -border_size_left, height - radius_bottom_left.y, }; const uint32_t inner_vertices[] = { radius_top_left.x, 0, width - radius_top_right.x, 0, width, radius_top_right.y, width, height - radius_bottom_right.y, width - radius_bottom_right.x, height, radius_bottom_left.x, height, 0, radius_top_left.y, 0, height - radius_bottom_left.y, radius_top_left.x, radius_top_left.y, width - radius_top_right.x, radius_top_right.y, width - radius_bottom_right.x, height - radius_bottom_right.y, radius_bottom_left.x, height - radius_bottom_left.y, }; //paint behind impPrePaint(); glPushMatrix(); glTranslatef(getX(), getY(), getZ()); // glBlendFunc(GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA); // glBlendFunc(GL_ONE, GL_ZERO); if (needReOrder()) { //setup stencils glClearStencil(0x0); glClear(GL_STENCIL_BUFFER_BIT); glEnable(GL_STENCIL_TEST); glStencilFunc(GL_ALWAYS, 0x0, 0x0); glStencilOp(GL_KEEP, GL_KEEP, GL_INCR); //draw inner curved corners drawInnerCornerCurves(BOOL_EN_MSAA); //draw inner rectangle (cover) drawElements(GL_QUADS, sizeof(indices) / sizeof(indices[0]), GL_INT, &inner_vertices[0], &colors[0], &indices[0]); //draw a texturized quad if (hasTexture()) { // glBlendFuncSeparate(GL_ZERO, GL_ONE, GL_SRC_COLOR, GL_ZERO); glBlendFunc(GL_ONE, GL_ZERO); drawTexturedQuad(getByRef()); } glStencilFunc(GL_EQUAL, 0x0, 0xff); //draw outer curved/solid corners drawOuterCornerX(BOOL_EN_MSAA); //draw outer side borders drawElements(GL_QUADS, sizeof(outer_border_indices) / sizeof(outer_border_indices[0]), GL_INT, &outer_border_vertices[0], &border_colors[0], &outer_border_indices[0]); glDisable(GL_STENCIL_TEST); } else { //draw outer side borders drawElements(GL_QUADS, sizeof(outer_border_indices) / sizeof(outer_border_indices[0]), GL_INT, &outer_border_vertices[0], &border_colors[0], &outer_border_indices[0]); //draw outer curved/solid corners drawOuterCornerX(BOOL_EN_MSAA); //draw inner curved corners drawInnerCornerCurves(BOOL_EN_MSAA); //draw inner rectangle (cover) drawElements(GL_QUADS, sizeof(indices) / sizeof(indices[0]), GL_INT, &inner_vertices[0], &colors[0], &indices[0]); //draw a texturized quad if (hasTexture()) { glBlendFunc(GL_ONE, GL_ZERO); drawTexturedQuad(getByRef()); } } glPopMatrix(); //paint above the rectangle impPostPaint(); //paint the components impShowComponents(); //paint above all the others impSpecialPaint(); }
void Scene::doFrame() { Player &player = _vm->_game->_player; bool flag = false; if (_action._selectedAction || !player._stepEnabled) { _action.clear(); _action._selectedAction = 0; } if (!_vm->_game->_trigger && !player._trigger) { // Refresh the dynamic hotspots if they've changed if (_dynamicHotspots._changed) _dynamicHotspots.refresh(); // Check all on-screen visual objects _vm->_game->_screenObjects.check(player._stepEnabled && !player._needToWalk && !_vm->_game->_fx); } if (_action._selectedAction && player._stepEnabled && !player._needToWalk && !_vm->_game->_trigger && !player._trigger) { _action.startAction(); if (_action._activeAction._verbId == Nebular::VERB_LOOK_AT) { _action._activeAction._verbId = VERB_LOOK; _action._savedFields._command = false; } flag = true; } if (flag || (_vm->_game->_trigger && _vm->_game->_triggerMode == SEQUENCE_TRIGGER_PREPARE)) { doPreactions(); } player.newWalk(); if (!_vm->_game->_fx) _frameStartTime = _vm->_events->getFrameCounter(); // Handle parser actions as well as game triggers if ((_action._inProgress && !player._moving && !player._needToWalk && (player._facing == player._turnToFacing) && !_vm->_game->_trigger) || (_vm->_game->_trigger && (_vm->_game->_triggerMode == SEQUENCE_TRIGGER_PARSER))) { doAction(); } if (_currentSceneId != _nextSceneId) { _freeAnimationFlag = true; } else { doSceneStep(); checkKeyboard(); if (_currentSceneId != _nextSceneId) { _freeAnimationFlag = true; } else { player.nextFrame(); // Cursor update code updateCursor(); if (!_vm->_game->_trigger) { // Handle any active sequences _sequences.tick(); // Handle any active animation if (_activeAnimation) _activeAnimation->update(); } // If the debugget flag is set, show the mouse position int mouseTextIndex = 0; if (_vm->_debugger->_showMousePos) { Common::Point pt = _vm->_events->mousePos(); Common::String msg = Common::String::format("(%d,%d)", pt.x, pt.y); mouseTextIndex = _kernelMessages.add(Common::Point(5, 5), 0x203, 0, 0, 1, msg); } if (!_vm->_game->_trigger) { if (_reloadSceneFlag || _currentSceneId != _nextSceneId) _kernelMessages.reset(); _kernelMessages.update(); } _userInterface._uiSlots.draw(!_vm->_game->_fx, _vm->_game->_fx); // Write any text needed by the interface if (_vm->_game->_fx) _userInterface.drawTextElements(); // Draw any elements drawElements((ScreenTransition)_vm->_game->_fx, _vm->_game->_fx); // Handle message updates if (_vm->_game->_fx) { uint32 priorTime = _vm->_game->_priorFrameTimer; uint32 newTime = _vm->_events->getFrameCounter(); _sequences.delay(priorTime, newTime); _kernelMessages.delay(priorTime, newTime); } if (_vm->_debugger->_showMousePos) // Mouse position display isn't persistent, so remove it _kernelMessages.remove(mouseTextIndex); // Original had a debugger check/call here to allow pausing after // drawing each frame. Not implemented under ScummVM } } if (_vm->_game->_fx) _cyclingActive = true; _vm->_game->_fx = kTransitionNone; // Handle freeing animation if necessary if (_activeAnimation && _activeAnimation->freeFlag()) _freeAnimationFlag = true; if (_freeAnimationFlag) freeAnimation(); }
inline void draw(const Pack & pack ) { drawElements(pack.mode,pack.count,pack.type,pack.indices); }
// Test a particular primitive mode static bool testPrim(GLenum mode, const GLfloat *verts, GLuint count) { GLfloat x, y; GLuint facing, fill; int drawMode; bool pass = true; // Loop over polygon mode: filled vs. outline for (fill = 0; fill < 2; fill++) { glPolygonMode(GL_FRONT_AND_BACK, fill ? GL_LINE : GL_FILL); // Loop over drawing mode: glBegin/End vs glDrawArrays vs glDrawElements for (drawMode = 0; drawMode < NUM_DRAW_MODES; drawMode++) { // Loop over CW vs. CCW winding (should make no difference) for (facing = 0; facing < 2; facing++) { if (facing == 0) { glFrontFace(GL_CCW); glCullFace(GL_BACK); } else { glFrontFace(GL_CW); glCullFace(GL_FRONT); } // Position the geometry at 9 different locations to test // clipping against the left, right, bottom and top edges of // the window. // Only the center location will be unclipped. for (y = -1.0; y <= 1.0; y += 1.0) { for (x = -1.0; x <= 1.0; x += 1.0) { bool quad_pass; GLfloat badColor[3]; glPushMatrix(); glTranslatef(x, y, 0.0); glClear(GL_COLOR_BUFFER_BIT); switch (drawMode) { case BEGIN_END: drawBeginEnd(mode, verts, count); break; case DRAW_ARRAYS: drawArrays(mode, verts, count); break; case DRAW_ELEMENTS: drawElements(mode, verts, count); break; default: assert(0); } glPopMatrix(); quad_pass = checkResult(badColor); pass = pass && quad_pass; reportSubtest(mode, drawMode, facing, fill, badColor, x, y, quad_pass); } } } } } return pass; }