Jump to content
  • Advertisement
Sign in to follow this  
svnstrk

OpenGL texture2DArray

This topic is 2919 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi,

im having problem trying to implement my texture2d Array. here is the c++/opengl code where i put my texture value:


unsigned char* texture3DFit = new unsigned char[textureWidth*textureDepth*textureHeight*3];

for(int i = 0; i<textureWidth*textureDepth*textureHeight*3;i++) {
texture3DFit = 50;
}

glBindTexture(GL_TEXTURE_2D_ARRAY, texName);
glTexParameteri(GL_TEXTURE_2D_ARRAY,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D_ARRAY,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D_ARRAY,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D_ARRAY,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE);
glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGB8, textureWidth, textureHeight,
textureDepth, 0, GL_RGB, GL_UNSIGNED_BYTE, texture3DFit);





i put the default value 50 for a while to check its right or wrong.
here is the glsl code:


#version 130
#extension GL_EXT_gpu_shader4: enable

uniform sampler2DArray tex;

varying float sphIndexY;
varying float sphIndexZ;

void main() {

vec3 coord;
coord.x = gl_TexCoord[0].s;
coord.y = gl_TexCoord[0].t;
coord.z = 1;
vec4 color = texture2DArray(tex, coord.xyz);

gl_FragColor = color;
}





the color appear on the screen is just blank. there are no error appeared when compiling the glsl. any1 notice anything wrong in the code?


thanks in advance

EDIT: i used geforce 9600GT 512MB if thats important

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!