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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:25:26+00:00 2026-06-13T01:25:26+00:00

As I know, OpenGL has highly supported NPOT textures since 3.0. Now I’ m

  • 0

As I know, OpenGL has highly supported NPOT textures since 3.0. Now I’ m facing an bizarre phenomenon that NPOT texture cannot be allocated with precise corresponding data. Words are plain. My testing code is as below.

glGenTextures(1, &texVoxels);
glBindTexture(GL_TEXTURE_3D, texVoxels);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);

int width = 513;
int height = 513;
int depth = 513;
unsigned char *data = new unsigned char[width*height*depth];
memset(data, 0, sizeof(unsigned char)*width*height*depth);

glTexImage3D(GL_TEXTURE_3D, 0, GL_LUMINANCE8, width, height,depth, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, data);

delete []data;
data = NULL;

As code shown above, I need to allocate an NPOT cubic texture of 2^N +1. But program will exit error on glTexImage3D(). The error, I think, is caused by “the size of data less than the texture needed”. Because if I allocate data larger enough, the program will pass.

How could I use NPOT texture and allocate data like this? Even though when the size of data is larger enough the program passes, I am really not sure about how data exactly corresponds to the texture location then.

PS. My graphic card is quadro fx 4800, which supports OpenGL 3.3.

  • 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-13T01:25:28+00:00Added an answer on June 13, 2026 at 1:25 am

    You probably need to set pixel storage parameters. Most importantly the row alignment. Try adding a

    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
    

    before calling glTexImage3D.

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

Sidebar

Related Questions

From what I know, everything about OpenGL changed since 3.1 and now I can't
I'm creating a GUI that has 1 to many OpenGL view forms. Now the
Can CUDA be used to generate OpenGL textures? I know it can be done
Anyone know how to create an OpenGL ES app that doesn't use the full
If you've seen my last few questions you'd know by now that I've been
assuming that some opengl-veterans might facepalm now :-) I am working on a tilebased
I have an issue that has me completely perplexed. I built a simple openGL
I know openGL is used for games, but is it possible to use OpenGL
I'm new to OpenGL. I have written a programm before getting to know OpenGL
I am dealing with Constructive Solid Geometry(CSG) modeling with OpenGL. I want to know

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.