Note that there are some explanatory texts on larger screens.

plurals
  1. POFilling list inside object and accessing to it later
    primarykey
    data
    text
    <p>I'm sorry if the title isn't very explicit, but I'll try to explain it better. I'm not very familiar with c++ and I'm using openFrameworks for the first time. I'm trying to do something that's probably quite easy, at least in other languages it is, but I'm not being able to do it :(</p> <p>I have a class Video and inside it I have an object <code>list&lt;ofImage&gt; keyFrames;</code> and several methods to interact with it like the following:</p> <pre><code>void addKeyFrame(ofImage img) { if(keyFrames.size() == 0) { keyFrames.push_front(img); } else { keyFrames.push_back(img); } } list&lt;ofImage&gt; * getKeyFrames() { list&lt;ofImage&gt; *list = &amp;keyFrames; return list; } void clearKeyFrames() { keyFrames.clear(); } </code></pre> <p>In other class I have several Video objects and I have a function that uses <code>addKeyFrame(ofImage img)</code> to fill the list for each object. In the end of that function if I print the list size it is greater than zero.</p> <p>Inside <code>draw()</code> function I iterate each Video object and I try to draw each image inside their keyFrame list, but the list is always empty and I just filled it with images... I'm using <code>getKeyFrames()</code> function to return a pointer to the list. How can it be empty if I just added objects to it in another function and if I verified that the size was greater than zero? And if I try to debug the application I feel even more lost lol.</p> <p>Please tell me if you need anymore information and if you know what I'm doing wrong. Thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload