Sign in to follow this  
billconan

a question about 1D float point texture

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this