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 7912559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:38:32+00:00 2026-06-03T13:38:32+00:00

I am learning OpenGL NeHe Production.When I read lesson22 Bump-Mapping、Multi-texture,I got a problem. When

  • 0

I am learning OpenGL NeHe Production.When I read lesson22 Bump-Mapping、Multi-texture,I got a problem.

When I load logo bmp file,I need to load two bmp files:one stores color information ,and another stores alpha information.
here is the two bmp files:
OpenGL_Alpha.bmp:
enter image description here

and OpenGL.bmp :
enter image description here

Here is the code:

if (Image=auxDIBImageLoad("Data/OpenGL_ALPHA.bmp")) {
            alpha=new char[4*Image->sizeX*Image->sizeY];
            for (int a=0; a<Image->sizeX*Image->sizeY; a++)
                    alpha[4*a+3]=Image->data[a*3]; //???????
            if (!(Image=auxDIBImageLoad("Data/OpenGL.bmp"))) status=false;
            for (a=0; a<Image->sizeX*Image->sizeY; a++) {
                    alpha[4*a]=Image->data[a*3];//??????????                         
                    alpha[4*a+1]=Image->data[a*3+1];             
                    alpha[4*a+2]=Image->data[a*3+2];                     
            }

            glGenTextures(1, &glLogo);  

            glBindTexture(GL_TEXTURE_2D, glLogo);
            glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
            glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
            glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, Image->sizeX, Image->sizeY, 0, GL_RGBA, GL_UNSIGNED_BYTE, alpha);
            delete alpha;

}

My question is :why the index of Image->data is a*3???

Could someone interpret for me ?

  • 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-03T13:38:34+00:00Added an answer on June 3, 2026 at 1:38 pm

    I am learning OpenGL NeHe Production.When I read lesson22 Bump-Mapping

    Why? The NeHe tutorials are terribly outdated, and the Bump Mapping technique outlined there completely obsolete. It’s been superseeded by shader based normal mapping for well over 13 years (until 2003 texture combiners were used instead of shaders).

    Also instead of BMPs you should use a image file format better suited for textures (with alpha channel). Like:

    • TGA
    • PNG
    • OpenEXR

    Also the various compressed DX texture formats are a good choice for several applications.

    My question is :why the index of Image->data is a*3???

    Extracting the red channel of a RGB DIB.

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

Sidebar

Related Questions

I'm currently learning OpenGL and got my first bunch of geometry and textures displayed.
I'm learning OpenGL ES. When I'm using texture for triangle, I meet error. Here
I've recently started learning OpenGl through the SB fifth edition, unfortunately got stuck right
I'm learning a spot of 3d opengl, and it's going rather well, I've got
I'm learning about how to use JOGL and OpenGL to render texture-mapped quads. I
I am learning OpenGL and having a problem with gluPerspective. Here is the code
I have just started learning OpenGL using the tutorials on Nehe, and so far
I'm learning OpenGL from this tutorial: http://openglbook.com/the-book/ . I have problem with shaders. I'm
I'm learning OpenGL and SDL and so far I've been able to properly draw
I've slightly modified the iPhone SDK's GLSprite example while learning OpenGL ES and it

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.