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

Trying to access getPixels() of a kha Image produces a crash #6

Closed
N8n5h opened this issue Feb 17, 2020 · 1 comment
Closed

Trying to access getPixels() of a kha Image produces a crash #6

N8n5h opened this issue Feb 17, 2020 · 1 comment

Comments

@N8n5h
Copy link

N8n5h commented Feb 17, 2020

Issue found by @QuantumCoderQC in the armory3d forum.

image

the crash error:

# Fatal error in , line 0
# unreachable code
#
#
#
#FailureMessage Object: 0x7ffc0a454a10
==== C stack trace ===============================

    /.../Armory SDK//Krom/Krom() [0xa36273]

With a bit of testing I pinpointed it to this line https://github.com/armory3d/Kromx/blob/93c7a3c80ea7aeb820c68d8e5de9ba04c9400a9c/Sources/main.cpp#L1740
it seems that trying to obtain the Value() produces the crash.

project for quick testing getpixels.zip

@luboslenco
Copy link
Member

This should apply to all Kha targets, to get image pixels set readable argument to true:

notifyOnInit(function() {
	iron.data.Data.getImage("tex1.png", function(img: kha.Image) {
		var p = img.getPixels();
		trace(p != null);
	}, true); // readable
});

Also make sure to access the image inside the getImage callback, it may be called later than the code below it.

Putting your example into armory_examples is welcome!

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