1

As shown in the picture below, which is taken from dynamic texture qt example, what I want to do is really simple, I want to get text input from the user and display it on a 3d object. I'm using C++ for the logic part of my application (just mentioning this because I don't know whether this animation is completely do-able in qml)

Qt dynamic texture example's image showing what I am trying to achieve

I am trying to create a credit card simulator, my 3d object would be the credit card and I would like to display the user's name and other such details, I would optionally like to add some logo to this credit card, if possible.

How would I go about doing this.

This is what my end 3d animation result should look like Credit card animation

eyllanesc
  • 235,170
  • 19
  • 170
  • 241

1 Answers1

0

do I understand correctly that you already have this textured credit card animation written in C++ and Qt3D?

So, I assume that you're using a QTextureMaterial for the credit card. This QTextureMaterial has a QTexture2D attached which in turn has a QTextureImage added to it.

I'd suggest you replace the current QTextureImage and subclass QPaintedTextureImage. QPaintedTextureImage allows you to draw the texture completely yourself, i.e. in the update function you first draw the (pre-loaded) standard credit card image using the painter and then on top you draw all the stuff you want to add. Since it's simply a QPainter you then use to paint you can paint anything on the credit card.

Florian Blume
  • 3,237
  • 17
  • 37
  • No, I don't have the textured credit card animation. I have not started the animation part yet. Right now, I just take the user details and print it on a `QPlainTextEdit'. This is all done in C++. Here is an image of what I have done till now [My 2D Credit Card Simulator App](https://imgur.com/a/k2hyFVv) Now, I want to upgrade my app and add some 3d graphics to the credit card. What I am struggling to understand is how do I take user input and add that details on top of a standard credit card image. – Mohammed Saayim Jul 19 '21 at 11:21
  • The image on my original _post_ is just an example of what I am trying to achieve(set text on a 3d object). And the animation gif of the credit card at the end of my post is what I would like to be my end result. How would I paint the user details on the credit card image after my app has run? Wouldn't it be easier to just set some text on to the image? Since I will get the user input after my app has compiled, my app has to print the user details on the credit card by itself, i.e I won't be able to draw the user details(like his name, CVV number etc), I want the app to be able to set it. – Mohammed Saayim Jul 19 '21 at 11:31
  • 1
    Then I'd suggest you try to implement a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) in which you show how far you got with your credit card animation. It's difficult to give you advice without out any code to discuss. You can use the Qt3D examples as a starting point. – Florian Blume Jul 19 '21 at 14:54