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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:06:45+00:00 2026-06-14T09:06:45+00:00

I am using teximage3D with gl_texture_3D and gl_texture_2D_array as a targets. I am creating

  • 0

I am using teximage3D with gl_texture_3D and gl_texture_2D_array as a targets.

I am creating 4 layers of colors and applying that on a sphere. So i am expecting that it will apply 4 layers on sphere equally.

But for GL_TEXTURE_3D, it repeats all the layers 2 times. whereas for gl_texture_2D_array it applies those layers only once as per expected.

int w = 4, h = 4, d = 4;
size_t size = w * h * d;

*format=GL_RGBA;
GLubyte *dataRGBA=new GLubyte[4*size];

for (int i=0; i<size/4; i++)
{
    dataRGBA[4*i]=200;
    dataRGBA[4*i+1]=0;
    dataRGBA[4*i+2]=0;
    dataRGBA[4*i+3]=255;
}

for (int i=size/4; i<size/2; i++)
{
    dataRGBA[4*i]=0;
    dataRGBA[4*i+1]=255;
    dataRGBA[4*i+2]=0;
    dataRGBA[4*i+3]=255;
}

for ( int i=size/2; i<(3*size)/4; i++)
{
    dataRGBA[4*i]=0;
    dataRGBA[4*i+1]=0;
    dataRGBA[4*i+2]=255;
    dataRGBA[4*i+3]=255;
}

for ( int i=(3*size)/4; i<size; i++)
{
    dataRGBA[4*i]=255;
    dataRGBA[4*i+1]=0;
    dataRGBA[4*i+2]=255;
    dataRGBA[4*i+3]=255;
}

glGenTextures(1,&id);
glBindTexture(*target11, id);
glTexParameteri(*target11, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
// when this texture needs to be magnified to fit on a big polygon, use linear interpolation of the texels to determine the color
glTexParameteri(*target11, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
// we want the texture to repeat over the S axis, so if we specify coordinates out of range we still get textured.
glTexParameteri(*target11, GL_TEXTURE_WRAP_S, GL_REPEAT);
// same as above for T axis
glTexParameteri(*target11, GL_TEXTURE_WRAP_T, GL_REPEAT);
// same as above for R axis
glTexParameteri(*target11, GL_TEXTURE_WRAP_R, GL_REPEAT);

glTexImage3D(*target11, 0, *format, w, h, d, 0, GL_RGBA, GL_UNSIGNED_BYTE, dataRGBA);               
  • 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-14T09:06:47+00:00Added an answer on June 14, 2026 at 9:06 am

    I believe that the issue is that a 2d texture array uses integers as texture indices, while a 3d texture scales the R axis 0-1 like the S and T axes.

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

Sidebar

Related Questions

Using a CSS image sprite, I'm creating an 'interactive' image where hovering over certain
I'm having a problem with texturing objects in OpenGL using texture atlases, I'm creating
Using Yii, I want to delete all the rows that are not from today.
Using SSRS 2008 R2 I have a background process that dynamically generates RDL for
I have a problem where the colors of any textures that I use are
Using ASP.NET MVC there are situations (such as form submission) that may require a
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
I'm trying to apply texture to a sprite using opengl as follows: int[] textures=new
Using CRM 4, I have an entity form that contains a tab with an
Using a populated Table Type as the source for a TSQL-Merge. I want to

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.