Skip to content
This repository has been archived by the owner on Jul 16, 2019. It is now read-only.

Opentk compat #1

Open
ghost opened this issue Oct 29, 2017 · 1 comment
Open

Opentk compat #1

ghost opened this issue Oct 29, 2017 · 1 comment

Comments

@ghost
Copy link

ghost commented Oct 29, 2017

Hey,
Im currently working with OpenTK and trying to use StbSharp to load a texture(in dot net core 2) i have tried using

        private byte[] LoadTexture(string filename, out int width, out int height)
        {
            ImageReader loader = new ImageReader();
            using (Stream stream = File.Open(filename, FileMode.Open)) 
            {
                byte[] buffer = File.ReadAllBytes(filename);
                Image image = Stb.LoadFromMemory(buffer, Stb.STBI_rgb_alpha);

                width = image.Width;
                height = image.Height;
                return image.Data;
            }
        }

and using the returning bytes directly with opentk which doesnt seem
Does anyone have any advice?

@ghost
Copy link
Author

ghost commented Oct 29, 2017

i have also tried

        private byte[] LoadTexture(string filename, out int width, out int height)
        {
            ImageReader loader = new ImageReader();
            using (Stream stream = File.Open(filename, FileMode.Open))
            {
                Image img = loader.Read(stream, Stb.STBI_rgb_alpha);

                width = img.Width;
                height = img.Height;
                Console.WriteLine("width: " + width + " height: " + height);
                return img.Data;
            }
        }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants