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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:21:49+00:00 2026-05-26T10:21:49+00:00

Suppose I load an array of bytes as RGB from a given file. I’ve

  • 0

Suppose I load an array of bytes as RGB from a given file.

I’ve read that OpenGL likes to store its textures “reversed”, and I’ve seen demo programs storing their images flipped upside down.

So in my program, must I reverse the loaded RGB array byte by byte, or line by line?

  • 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-05-26T10:21:49+00:00Added an answer on May 26, 2026 at 10:21 am

    That’s because the Bitmap(.bmp) format stores it’s lines upside-down. I’m not sure who came up with that, but it’s a file-format thing. So well, yes, you must do it if you use your own .bmp loader. You can, however, use one which has already been written which “upside-downs” the image for you. Again, it’s only a .bmp thing. OpenGL works by default on non-flipped images.

    Here’s a little trick: If you don’t want to change your .bmp loader, you can tell OpenGL to flip your image for you:

    glMatrixMode(GL_TEXTURE);
    glLoadIdentity();
    glScalef(1.0f, -1.0f, 1.0f);
    glMatrixMode(GL_MODELVIEW);
    

    That’s what I meant with “by default”. You can turn OpenGL upside-down if you want to. However, this only works if you only load .bmp files. Other file formats store their lines properly. Therefore, I prefer the first approach – use a real .bmp loader.

    Just to be clear: IF you load .bmp files, you MUST flip the image either by hand before sending it to OpenGL (which most .bmp loaders do), OR send the unflipped image to OpenGL and add the above code before your rendering code.

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

Sidebar

Related Questions

suppose i have an javascript array userName.I want to load it from a database
Suppose I load some Flash movie that I know at some point in the
I'm trying to load some decimal values from a file but I can't work
Suppose i have some tabs (e.g. jquery tab) and I want to dynamically load
Suppose a HTML document has a iframe. Using javascript,I want to detect ,on load
Suppose, objects of type A are stored in DB. Here's the way I load
I am using jQuery to load a page by AJAX using $.ajax (suppose test.html).
I have a jsonstore that is supposed to load a user's information. I have
Suppose I have a stringbuilder in C# that does this: StringBuilder sb = new
I'm opening a new thread based on this how to store an array in

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.