Jump to content
  • Advertisement
Sign in to follow this  
billconan

a question about 1D float point texture

This topic is 3257 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

hello there, i'm trying to pass a lot of float point numbers to the frag shader. i don't want my float points to lose any precision, so i passed it as a float texture, and this is my setup:

 glGenTextures(1, &cuttingPlaneTable);

 glActiveTexture(GL_TEXTURE1);
 glBindTexture(GL_TEXTURE_1D, cuttingPlaneTable);
 glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_REPEAT);
 glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_T, GL_REPEAT);
 glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
 glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
 glTexImage1D(GL_TEXTURE_1D, 0, GL_LUMINANCE32F_ARB , 1000, 0, GL_LUMINANCE, GL_FLOAT, cuttingPlanes);


 printf("[%f,%f,%f]\n",cuttingPlanes[0],cuttingPlanes[1],cuttingPlanes[2]);

		glUniform1i(glGetUniformLocation(shaderID,"cuttingPlaneTable"),1);
but it turned out that there is some limitation on the size of the 1D texture, in my code, if i specify the size as 1000, everything is fine, but if i use the real size, which is 20000, the float numbers become zero in the shader. what am i suppose to fix this problem? will 2D texture be a solution? and how can i know the size limitations of different texture map types? thank you

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!