-
Notifications
You must be signed in to change notification settings - Fork 292
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
Font's returned as garbage #24
Comments
On my phone so I can't look too closely. I'm pretty sure that the problem is that you are indexing your pixels array incorrectly, though. You should be using "j + (i * width)" as your index. It makes sense that you are only filling in the first two rows with your current code, although it should all be garbage data.
On Jun 15, 2017, at 7:06 PM, dmitsuki <notifications@github.com<mailto:notifications@github.com>> wrote:
I'm not getting back the default font correctly. I'm receiving it as garbage. Only portions of the first two lines are read, and nothing else is returned properly
IO io = ImGui.GetIO();
FontTextureData textureData = io.FontAtlas.GetTexDataAsRGBA32();
int[] pixels = new int[textureData.Width * textureData.Height];
int count = 0;
for (int i = 0; i < textureData.Height; i++)
{
for (int j = 0; j < textureData.Width; j++)
{
pixels[i + j] = *((uint* )textureData.Pixels + count);
count += textureData.BytesPerPixel;
}
}
Is an example of how I'm getting the data. It seems to read the only the first two lines, then it returns transparent pixels for the rest.
If I load the font texture myself (as a png I took from the native imgui) everything works fine.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmellinoe%2FImGui.NET%2Fissues%2F24&data=02%7C01%7Cerme%40microsoft.com%7C1773c744e51944f6d74508d4b4432bb3%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636331647966005132&sdata=r0hDu51UZazEj5DyRrkF8LO7El8hcJVTWLfSpdlRsTg%3D&reserved=0>, or mute the thread<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAIgXwdjyefsRkaLG5egsFbTrakYa9ygXks5sEbj4gaJpZM4N72C1&data=02%7C01%7Cerme%40microsoft.com%7C1773c744e51944f6d74508d4b4432bb3%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636331647966005132&sdata=cOWeqjSbO1Ei0oWtsrQuBFDsG8hg3VyG8bn%2FPLtDA0I%3D&reserved=0>.
|
DOH! I have been staring at this for so long my brain was automatically turning "i+j" into the definition of a multidimensional array or something, but the computer correctly assumes it's just arithmetic. I'm somewhat curious as to how the first two lines always came out correctly but that's enough of that for now. Sorry for that. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm not getting back the default font correctly. I'm receiving it as garbage. Only portions of the first two lines are read, and nothing else is returned properly
IO io = ImGui.GetIO();
int[] pixels = new int[textureData.Width * textureData.Height];
int count = 0;
for (int i = 0; i < textureData.Height; i++)
{
for (int j = 0; j < textureData.Width; j++)
{
Is an example of how I'm getting the data. It seems to read the only the first two lines, then it returns transparent pixels for the rest.
If I load the font texture myself (as a png I took from the native imgui) everything works fine.
The text was updated successfully, but these errors were encountered: