Search Results

Search found 1000 results on 40 pages for 'scene'.

Page 14/40 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • Qt drag & drop button; drop not detecting

    - by Thomas Verbeke
    I'm creating a 2D game in QT and i'm trying to implement a drag & drop into my program. For some reason the drop is not registered: qDebug should print a message on dropping but this doesn't happen. #include "dialog.h" #include "ui_dialog.h" #include "world.h" #include <vector> Dialog::Dialog(QWidget *parent) : QDialog(parent), ui(new Ui::Dialog) { ui->setupUi(this); scene = new QGraphicsScene(this); ui->graphicsView->setScene(scene); MySquare *item; QGraphicsRectItem *enemyItem; World *myWorld = new World(); std::vector<Tile*> tiles = myWorld->createWorld(":/texture.jpg"); int count = 0; foreach (Tile *tile, tiles){ count++; item = new MySquare(tile->getXPos()*4,tile->getYPos()*4,4,4); item->setBrush(QColor(tile->getValue()*255,tile->getValue()*255,tile->getValue()*255)); item->setAcceptDrops(true); scene->addItem(item); } player = new MySquare(10,20,10,10); player->setAcceptDrops(true); scene->addItem(player); //drag & drop part QPushButton *pushButton = new QPushButton("Click Me",this); connect(pushButton,SIGNAL(pressed()),this,SLOT(makeDrag())); setAcceptDrops(true); } void Dialog::makeDrag() { QDrag *dr = new QDrag(this); // The data to be transferred by the drag and drop operation is contained in a QMimeData object QMimeData *data = new QMimeData; data->setText("This is a test"); // Assign ownership of the QMimeData object to the QDrag object. dr->setMimeData(data); // Start the drag and drop operation dr->start(); } mysquare.cpp #include "mysquare.h" MySquare::MySquare(int _x,int _y, int _w, int _h) { isPlayer=false; Pressed=false; setFlag(ItemIsMovable); setFlag(ItemIsFocusable); setAcceptDrops(true); color=Qt::red; color_pressed = Qt::green; x = _x; y = _y; w = _w; h = _h; } QRectF MySquare::boundingRect() const { return QRectF(x,y,w,h); } void MySquare::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { QRectF rec = boundingRect(); QBrush brush(color); if (Pressed){ brush.setColor(color); } else { brush.setColor(color_pressed); } painter->fillRect(rec,brush); painter->drawRect(rec); } void MySquare::mousePressEvent(QGraphicsSceneMouseEvent *event) { Pressed=true; update(); QGraphicsItem::mousePressEvent(event); qDebug() << "mouse Pressed"; } void MySquare::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { Pressed=false; update(); QGraphicsItem::mousePressEvent(event); qDebug() << "mouse Released"; } void MySquare::keyPressEvent(QKeyEvent *event){ int x = pos().x(); int y = pos().y(); //key handling QGraphicsItem::keyPressEvent(event); } void MySquare::dropEvent(QDropEvent *event) { qDebug("dropEvent - square"); // Unpack dropped data and handle it the way you want qDebug("Contents: %s", event->mimeData()->text().toLatin1().data()); } void MySquare::dragMoveEvent(QDragMoveEvent *event){ qDebug("dragMoveEvent - square "); event->accept(); } void MySquare::dragEnterEvent(QDragEnterEvent *event){ event->setAccepted(true); qDebug("dragEnterEvent - square"); event->acceptProposedAction(); } void MySquare::setBrush(QColor _color){ color = _color; color_pressed = _color; update(); //repaint } edit; there is no problem with qDebug() i'm just using it to test them i'm inside the drag events..which i'm not

    Read the article

  • WPF Animate a Matrix using interpolation

    - by Mark
    I'm having a issue with my application that is using touch gestures to scale, translate and rotate my scene. I was using a TransformGroup which contained TranslateTransform, ScaleTransform and a RotateTransform but I could not get the movement correct, it always jumps and skips, so I moved to a MaxtrixTransform which I was able to use much easier to get my scene to be zoomable, rotatable and panable nicely. However, what I later found out was that you cannot animate smoothly (using interpolation) the values of a Matrix, for what reason I have no idea, but its part of the MSDN doco and the properties of the Matrix are not dependency properties anyways... Has anyone had any luck animating a matrix to make it smooth? The only idea(s) I have had is to animate a few different, custom DP which all have callbacks that I update the matrix from OR To convert the matrix to a set of Transform objects that I then animate and then afterwords convert back. Is there a smarter way to do this?

    Read the article

  • WPF Animate a Maxtrix using interpolation

    - by Mark
    Im having a issue with my application that is using touch gestures to scale, translate and rotate my scene. I was using a TransformGroup which contained TranslateTransform, ScaleTransform and a RotateTransform but I could not get the movement correct, it always jumps and skips, so I moved to a MaxtrixTransform which I was able to use much easier to get my scene to be zoomable, rotatable and panable nicely. However, what I later found out was that you cannot animate smoothly (using interpolation) the values of a Matrix, for what reason I have no idea, but its part of the MSDN doco and the properties of the Matrix are not dependency properties anyways... Has anyone had any luck animating a maxtrix to make it smooth? The only idea(s) I have had is to animate a few different, custom DP which all have callbacks that I update the Matrix from OR To convert the Maxtix to a set of Transform object that I then animate and then afterwords convert back. Is there a smarter way to do this?

    Read the article

  • running requestAnimationFrame from within a new object

    - by JVE999
    I'm having trouble running an animation. This is inside var ob1 = function() {};. When called, it runs for a while and then I get the error Uncaught RangeError: Maximum call stack size exceeded. However, this same structure has no problems running outside of the object. /////////////// Render the scene /////////////// this.render = function (){ renderer.render(scene,camera); if(isControls == true) controls.update(clock.getDelta()); this.animate(); //console.log(true); requestAnimationFrame(this.render()); } /////////////// Update objects /////////////// this.animate = function (){ console.log("!"); }

    Read the article

  • Using cProfile results with KCacheGrind

    - by Adam Luchjenbroers
    I'm using cProfile to profile my Python program. Based upon this talk I was under the impression that KCacheGrind could parse and display the output from cProfile. However, when I go to import the file, KCacheGrind just displays an 'Unknown File Format' error in the status bar and sits there displaying nothing. Is there something special I need to do before my profiling stats are compatible with KCacheGrind? ... if profile: import cProfile profileFileName = 'Profiles/pythonray_' + time.strftime('%Y%m%d_%H%M%S') + '.profile' profile = cProfile.Profile() profile.run('pilImage = camera.render(scene, samplePattern)') profile.dump_stats(profileFileName) profile.print_stats() else: pilImage = camera.render(scene, samplePattern) ... Package Versions KCacheGrind 4.3.1 Python 2.6.2

    Read the article

  • iPhone post-processing with a single FBO with Opengl ES 2.0?

    - by Jing
    I am trying to implement post-processing (blur, bloom, etc.) on the iPhone using OpenGL ES 2.0. I am running into some issues. When rendering during my second rendering step, I end up drawing a completely black quad to the screen instead of the scene (it appears that the texture data is missing) so I am wondering if the cause is using a single FBO. Is it incorrect to use a single FBO in the following fashion? For the first pass (regular scene rendering), I attach a texture as COLOR_ATTACHMENT_0 and render to a texture. glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texturebuffer, 0) For the second pass (post-processing), I attach the color renderbuffer to COLOR_ATTACHMENT_0 glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, colorRenderbuffer) Then use the texture from the first pass for rendering as a quad on the screen.

    Read the article

  • Conceptually, how does replay work in a game?

    - by SnOrfus
    I was kind of curious as to how replay might be implemented in a game. Initially, I thought that there would be just a command list of every player/ai action that was taken in the game, and it then 're-plays' the game and lets the engine render as usual. However, I have looked at replays in FPS/RTS games, and upon careful inspection even things like the particles and graphical/audible glitches are consistent (and those glitches are generally *in*consistent). So How does this happen. In fixed camera angle games I though it might just write every frame of the whole scene to a stream that gets stored and then just replays the stream back, but that doesn't seem like enough for games that allow you to pause and move the camera around. You'd have to store the locations of everything in the scene at all points in time (No?). So for things like particles, that's a lot of data to push which seems like a significant draw on the game's performance whilst playing.

    Read the article

  • Hidden line removal in JavaScript or Python?

    - by feklee
    I have the following task: Input: A 3D scene comprised of a set of cuboids. Could be broken down to a set of triangles. A description of a camera: position, direction, focal length. Output: 2D wire frame projection of the scene as a set of lines. Important: Hidden lines removal should have been applied. Platform: Web app running on Google App Engine for Python. Any idea if there is a JavaScript or Python library that does this?

    Read the article

  • How many real world developers are involved with the Demoscene?

    - by spoulson
    I grew up learning to code based on what I've experienced with the demoscene. It seems to be a pretty sparse subculture in the US. How many developers watch or participate in the scene? Teaser: If you haven't checked out the scene before, take a look at one of my favorites: Debris by Farbrausch. Watch on demoscene.tv or download the app (179k) and run it yourself. No video, all realtime rendering and audio. Think, a small group of guys wrote this for a competition on their free time.

    Read the article

  • Lots of pointer casts in QGraphicsView framework and performance

    - by kleimola
    Since most of the convenience functions of QGraphicsScene and QGraphicsItem (such as items(), collidingItems(), childItems() etc.) return a QList you're forced to do lots of qgraphicsitem_cast or static_cast and QGraphicsItem::Type() checks to get hold of the actual items when you have lots of different type of items in the scene. I thought doing lots of subclass casts were not a desirable coding style, but I guess in this case there are no other viable way, or is there? QList<QGraphicsItem *> itemsHit = someItem->collidingItems(Qt::IntersectsItemShape); foreach (QGraphicsItem *item, itemsHit) { if (item->type() == QGraphicsEllipseItem::type()) { QGraphicsEllipseItem *ellipse = qgraphicsitem_cast<QGraphicsEllipseItem *>(item); // do something } else if (item->type() == MyItemSubclass::type()) { MyItemSubClass *myItem = qgraphicsitem_cast<MyItemSubClass *>(item); // do something } // etc } The above qgraphicsitem_cast could be replaced by static_cast since correct type is already verified. When doing lots of these all the time (very dynamic scene), will the numerous casting affect performance beyond the normal if-else evaluation?

    Read the article

  • Collision detection between layers in Cocos2d?

    - by ipodfreak0313
    I am making a game in Cocos2d. I have enemies that shoot, and have the character shoot. I created a separate layer for the enemies (and their bullets) and a separate layer for the character (and its bullets). The problem is, I don't know how to detect collisions between the two layers. Note, I have the Scene in HelloWorldLayer, and each of the above layers is a child of the scene. Any help is appreciated. Thanks!

    Read the article

  • AS3IsoLib New IsoSprite

    - by KoopaTroopa
    I'm following a guide (http://www.jsparrowhawk.com/blog/?p=75) on how to use the As3IsoLib library. It seems his examples are a little erroneous at times. I'm at the part of creating a sprite, assigning it an image and then rendering. When I test my application I get my box and grid but not the sprite. var mySprite:IsoSprite; mySprite = new IsoSprite(); mySprite.setSize(40, 40, 0); mySprite.moveTo(120, 40, 0); scene.addChild(mySprite); var myImgLoader:Loader = new Loader(); var myImgURL:URLRequest = new URLRequest("http://www.jsparrowhawk.com/blog/wp-content/uploads/2011/10/as3isolib_styling_6b.jpg"); myImgLoader.load(myImgURL); myImgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imgLoadComplete); function imgLoadComplete(e:Event):void { var myImg:Bitmap = new Bitmap(e.target.content.bitmapData); mySprite.sprites = [myImg]; scene.render(); }

    Read the article

  • How do I manipulate a tree of immutable objects?

    - by Frederik
    I'm building an entire application out of immutable objects so that multi-threading and undo become easier to implement. I'm using the Google Collections Library which provides immutable versions of Map, List, and Set. My application model looks like a tree: Scene is a top-level object that contains a reference to a root Node. Each Node can contain child Nodes and Ports. An object graph might look like this: Scene | +-- Node | +-- Node | +- Port +-- Node | +- Port +- Port If all of these objects are immutable, controlled by a top-level SceneController object: What is the best way to construct this hierarchy? How would I replace an object that is arbitrarily deep in the object tree? Is there a way to support back-links, e.g. a Node having a "parent" attribute?

    Read the article

  • Has anybody here helped fake-create technical details for the movies / TV shows?

    - by none
    This is based on another SO question: Have you ever recognized any source code visible in a movie? where we were discussing some of the cheap tricks to add technical "details" to a scene (e.g. showing HTML/java script code or hexdumps and mockup GUIs). Which brought up the question: Has anybody here helped create "computer effects" (e.g. as a technical consultant) for movies/TV shows to add some pseudo-technical details to a scene? If you can, please do provide details - what exactly were you supposed to do, and what did you end up doing? Were your proud of your contribution to the final product? What was the pay like?

    Read the article

  • Google s'achemine vers la recherche sans recherche ou comment délivrer des résultats sans que l'utilisateur n'ait à le demander

    Google s'achemine vers la recherche sans recherche Ou comment délivrer des résultats sans que l'utilisateur n'ait à le demander Lors de la conférence « LeWeb10 », qui se tient actuellement à Paris (à Saint-Denis exactement), Marissa Mayer, ex-Vice Présidente du Search Product (du moteur de recherche donc) de Google - et à présent en charge de la branche Géolocalisation et des Services Localisés - est revenue sur une des perspectives d'avenir de la société. Lors d'un entretien sur la grande scène de la manifestion, elle a ainsi laissé entendre qu'un des prochains produits importants de Google serait la « découverte contextuelle » (contextual discovery) Il ne s...

    Read the article

  • Why is a fully transparent pixel still rendered?

    - by Mr Bell
    I am trying to make a pixel shader that achieves an effect similar to this video http://www.youtube.com/watch?v=f1uZvurrhig&feature=related My basic idea is render the scene to a temp render target then Render the previously rendered image with a slight fade on to another temp render target Draw the current scene on top of that Draw the results on to a render target that persists between draws Draw the results on to the screen But I am having problems with the fading portion. If I have my pixel shader return a color with its A component set to 0, shouldn't that basically amount to drawing nothing? (Assuming that sprite batch blend mode is set to AlphaBlend) To test this I have my pixel shader return a transparent red color. Instead of nothing being drawn, it draws a partially transparent red box. I hope that my question makes sense, but if it doesnt please ask me to clarify Here is the drawing code public override void Draw(GameTime gameTime) { GraphicsDevice.SamplerStates[1] = SamplerState.PointWrap; drawImageOnClearedRenderTarget(presentationTarget, tempRenderTarget, fadeEffect); drawImageOnRenderTarget(sceneRenderTarget, tempRenderTarget); drawImageOnClearedRenderTarget(tempRenderTarget, presentationTarget); GraphicsDevice.SetRenderTarget(null); drawImage(backgroundTexture); drawImage(presentationTarget); base.Draw(gameTime); } private void drawImage(Texture2D image, Effect effect = null) { spriteBatch.Begin(0, BlendState.AlphaBlend, SamplerState.PointWrap, null, null, effect); spriteBatch.Draw(image, new Rectangle(0, 0, width, height), Color.White); spriteBatch.End(); } private void drawImageOnRenderTarget(Texture2D image, RenderTarget2D target, Effect effect = null) { GraphicsDevice.SetRenderTarget(target); drawImage(image, effect); } private void drawImageOnClearedRenderTarget(Texture2D image, RenderTarget2D target, Effect effect = null) { GraphicsDevice.SetRenderTarget(target); GraphicsDevice.Clear(Color.Transparent); drawImage(image, effect); } Here is the fade pixel shader sampler TextureSampler : register(s0); float4 PixelShaderFunction(float2 texCoord : TEXCOORD0) : COLOR0 { float4 c = 0; c = tex2D(TextureSampler, texCoord); //c.a = clamp(c.a - 0.05, 0, 1); c.r = 1; c.g = 0; c.b = 0; c.a = 0; return c; } technique Fade { pass Pass1 { PixelShader = compile ps_2_0 PixelShaderFunction(); } }

    Read the article

  • Getting .mesh & .skeleton from Blender2Ogre export

    - by Songbreaker
    I have downloaded the add-on blender2ogre from this source : http://code.google.com/p/blender2ogre/ And I have created a simple mesh, with walking animation (similar to the gingerbreadman tutorial). My question is, whenever I want to export the project, I can only see the .scene export format. There is no option whatsoever to export as .mesh and .skeleton. Also, how can I export the walking animation separately, in other words, if my project have couple more animation, how can i separate those during export?

    Read the article

  • Desktop Fun: Happy New Year Wallpaper Collection [Bonus Edition]

    - by Asian Angel
    As this year draws to a close, it is a time to reflect back on what we have done this year and to look forward to the new one. To help commemorate the event we have put together a bonus size edition of Happy New Year wallpapers for your desktops. Extra Note: We made a special effort to find wallpapers for this collection without the year “printed” on them, thus allowing for reuse as desired and/or needed beyond the 2010 – 2011 holiday. Note: Click on the picture to see the full-size image—these wallpapers vary in size so you may need to crop, stretch, or place them on a colored background in order to best match them to your screen’s resolution. For more New Year’s desktop goodness be sure to check out our Happy New Year icon & font packs collection (link at bottom)! Note: This wallpaper will need to be placed on a larger white background in order to increase the height. Note: This wallpaper will need to be placed on a larger background in order to increase the width and height. Note: This wallpaper comes in multiple sizes and will need to be downloaded as a zip file. Note: This wallpaper comes in multiple sizes and will need to be downloaded as a zip file. Note: The download size for the original version of this wallpaper is 15 MB. Note: The download size for the original version of this wallpaper is 15 MB. More Happy New Year Fun Desktop Fun: Happy New Year Icon and Font Packs For more wallpapers be certain to see our great collections in the Desktop Fun section. Latest Features How-To Geek ETC How to Use the Avira Rescue CD to Clean Your Infected PC The Complete List of iPad Tips, Tricks, and Tutorials Is Your Desktop Printer More Expensive Than Printing Services? 20 OS X Keyboard Shortcuts You Might Not Know HTG Explains: Which Linux File System Should You Choose? HTG Explains: Why Does Photo Paper Improve Print Quality? The Outdoor Lights Scene from National Lampoon’s Christmas Vacation [Video] The Famous Home Alone Pizza Delivery Scene [Classic Video] Chronicles of Narnia: The Voyage of the Dawn Treader Theme for Windows 7 Cardinal and Rabbit Sharing a Tree on a Cold Winter Morning Wallpaper An Alternate Star Wars Christmas Special [Video] Sunset in a Tropical Paradise Wallpaper

    Read the article

  • OpenGL 2.1+ Render with data returned form assimp library

    - by Bình Nguyên
    I have just readed this tutorial about load a 3D model file: http://www.lighthouse3d.com/cg-topics/code-samples/importing-3d-models-with-assimp/#comment-14551. Its render routine uses a recursive_render function to scan all node. My question: What is a aiNode struct store? What different form this method and above method: for (int i=0; imNumMesh; ++i) { draw scene-mMeshes[i]; } Thanks for reading!

    Read the article

  • Render an image with separate layers for shadows/reflections in 3D Studio Max?

    - by Bernd Plontsch
    I have a scene with a simple object standing on a ground in the center. Caused by lights and the ground material there is some shadow and reflection on the ground surrounding the object. How can I render an image containing 3 separate layers for the object the ground the reflection / shadow on the ground Which format to use for this (it should include all 3 layers + I should be able to enable/disable them in Photoshop)? How do I define or prepare those layers for being rendering as image layers?

    Read the article

  • How can I implement 2D cel shading in XNA?

    - by Artii
    So I was just wondering on how to give a scene I am rendering a hand drawn look (like say Crayon Physics). I don't really want to preprocess the sprites and was thinking of using a shader. Cel shading supplies the effect I want to achieve, but I am only aware of the 3D instances for it. So I wanted to ask if anyone knew a way to get this effect in 2D, or if cel shading would work just as fine on 2D scenes?

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >