Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8479713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:06:32+00:00 2026-06-10T19:06:32+00:00

I have loaded in an image with this method: public static int LoadTexture(string file)

  • 0

I have loaded in an image with this method:

    public static int LoadTexture(string file)
    {
        Bitmap bitmap = new Bitmap(file);

        int tex;

        GL.GenTextures(1, out tex);
        GL.BindTexture(TextureTarget.Texture2D, tex);

        System.Drawing.Imaging.BitmapData data = bitmap.LockBits(new System.Drawing.Rectangle(0, 0, bitmap.Width, bitmap.Height),
            System.Drawing.Imaging.ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);

        GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, data.Width, data.Height, 0,
            OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, data.Scan0);

        bitmap.UnlockBits(data);

        GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
        GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
        GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureWrapMode.Repeat);
        GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureWrapMode.Repeat);

        Console.WriteLine("[ImageDisplay] Loaded image: " + file);

        return tex;
    }

I need to modify pixels within this image, so i have used this:

GL.TexSubImage2D(TextureTarget.Texture2D, 0, X, Y, 1, 1, OpenTK.Graphics.OpenGL.PixelFormat.Rgb, PixelType.UnsignedInt, new uint[] { 0xFFFF0000 });

My problem, is that only non-transparent pixels change to red, the transparent pixels do not change at all.

How could i fix this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T19:06:33+00:00Added an answer on June 10, 2026 at 7:06 pm
    OpenTK.Graphics.OpenGL.PixelFormat.Rgb, PixelType.UnsignedInt, new uint[] { 0xFFFF0000 }
    

    The pixel transfer format you state is GL_RGB. That means 3 components: red, green, and blue, in that order.

    The pixel transfer type is GL_UNSIGNED_INT, which means that each component is an unsigned integer. Thus, you are expected to provide an array of 3 unsigned integers per pixel.

    If you want each component to be an unsigned byte, then you should use that as your type. And your array should be an array of unsigned bytes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have loaded image into a new, initialized Oracle ORDImage object and am processing
I have loaded an byte array image from a web service to my asp.net
I Want to load Image size 2550X3300 (i.e 1.7 Mb size), i have loaded
I have a UIImageView which has a png image sequence loaded into it. My
I have to implement an Image Gallery for the iPhone iOS. Pictures are loaded
I have loaded the calendar in my LWUIT based UI. Thanks to this thread
I have loaded an xmi file with an uml diagram. As a result I
I have loaded an XML file using simplexml_load_file($filePath,'SimpleXMLElement', LIBXML_NOCDATA); And for most of the
I have loaded a jpg image in which I want to draw letters and
This is my class in essence import mx.controls.Image; public class ImageFrameView extends Image {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.