Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug in IL_NUM_IMAGES for animations #13

Open
WilbertD opened this issue Jan 24, 2015 · 1 comment
Open

bug in IL_NUM_IMAGES for animations #13

WilbertD opened this issue Jan 24, 2015 · 1 comment

Comments

@WilbertD
Copy link

There seems to be some issues with IL_NUM_IMAGES:

@bcampbell
Copy link
Contributor

bcampbell commented Oct 23, 2016

See also #34.

The current implementation of IL_NUM_IMAGES returns the number of images after the currently-bound image. So the result returned depends upon which frame you're currently on (eg if you're on the first frame of a 10 frame animation, IL_NUM_IMAGES will return 9. If you're on frame 2, it'll return 8. And so on.).

The animation support is really fuzzy. I'm planning to do some cleanup to clarify how it all works.
Basically, I think that:

  • IL_NUM_IMAGES should always return the number of images in the whole animation, regardless of which frame you're on.
  • ilActiveImage(N) should jump to frame N in the anim, rather than advancing N beyond the current frame (currently it advances N frames from the current one - see ilActiveImage() is unclear #34).

The obvious loop is:

num_frames = ilGetInteger(IL_NUM_IMAGES);
for(n=0;n<num_frames; ++n) {
    ilActiveImage(n);
    ... do stuff with frame n...
}

But this doesn't work with the current code. I think it should.

Most of these same issues also apply to Mipmaps, Layers and Cubemap faces.
And obviously, it gets even more complicated when you want to deal with, say, animated cubemaps with mipmap levels ;-)
So I think my planned changes will break the API... but then I feel it's not too big a deal because the API is already pretty broken in this respect. Feedback welcome!

bcampbell added a commit to bcampbell/DevIL that referenced this issue Dec 10, 2016
This is an interim commit, just pushed up as a backup.
Don't try and _use_ it or anything!
I'm making some big changes to the internals, as part of an
attempt to sort out the confusing iActive[Image|MipMap|Layer|Face]()
situation. (as per bugs DentonW#13 and DentonW#34).
bcampbell added a commit to bcampbell/DevIL that referenced this issue Dec 18, 2016
This is an interim commit, just pushed up as a backup.
Don't try and _use_ it or anything!
I'm making some big changes to the internals, as part of an
attempt to sort out the confusing iActive[Image|MipMap|Layer|Face]()
situation. (as per bugs DentonW#13 and DentonW#34).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants