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

  • SEARCH
  • Home
  • 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 7922121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:50:42+00:00 2026-06-03T16:50:42+00:00

I have a texture onto which I render 16 drawings. The texture is 1024×1024

  • 0

I have a texture onto which I render 16 drawings. The texture is 1024×1024 in size and it’s divided into 4×4 “slots”, each 256×256 pixels.

Before I render a new drawing into a slot, I want to clear it so that the old drawing is erased and the slot is totally transparent (alpha=0).

Is there a way to do it with OpenGL or need I just access the texture pixels directly in memory and clear them with memset oslt?

  • 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-03T16:50:44+00:00Added an answer on June 3, 2026 at 4:50 pm

    I imagine you’d just update the current texture normally:

    std::vector<unsigned char> emptyPixels(1024*1024*4, 0); // Assuming RGBA / GL_UNSIGNED_BYTE
    glBindTexture(GL_TEXTURE_2D, yourTextureId);
    glTexSubImage2D(GL_TEXTURE_2D,
                    0,
                    0,
                    0,
                    1024,
                    1024,
                    GL_RGBA,
                    GL_UNSIGNED_BYTE,
                    emptyPixels.data());  // Or &emptyPixels[0] if you're stuck with C++03
    

    Even though you’re replacing every pixel, glTexSubImage2D is faster than recreating a new texture.

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

Sidebar

Related Questions

i have a 1024 x 1024 image I use for a texture in my
I have a billboard quad with a texture mapped onto it. This is basically
I have a texture loaded into memory that is of RGBA format with various
Let's say I have this texture on a polygon: How would I render that
Let's say I have a texture which is one file with separate 20 px
I have an OpenGL RGBA texture and I blit another RGBA texture onto it
I have a texture which has only 1 channel as it's a grayscale image.
I have one texture that has some portions which are transparent transparent I want
I am wondering about when I have a texture named tex which I create
I have a texture where it is a 4x4 grid in a 256x256 pixel

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.