Thanks for your response, Clay.
I guess you are converting the luminance values to RGB in the fragment shader?
Yep, that’s the idea… I’m trying to use a raycasting algorithm which link I cannot paste because this post gets denied otherwise -.-
However, the only reason I can see to process more than one 2D texture per pass of the fragment shader would be if you want to interpolate the luminance values from luminance values from neighboring layers in the third dimension? Of course, you must also handle the top and bottom-most layers as special cases.
Sorry, I don’t see why the top and bottom layers are special cases :S
The reason I have to use multiple 2D textures is that the maximum size of a texture is 2048x2048, while the 3D image I’m trying to render is 256x256x128… so I need exactly 2 textures to be able to have the entire image in the fragment shader.
Yep, I’ve done this before. I know I have 8 available textures.
Recently I’ve realized that something weird happens… At the risk of looking like a noob (in fact, I am) and of bothering you too much, I’d like to ask if you know why this may happen:
Passing only one texture to the fragment shader (so only half of the 3D image) and trying to print the whole texture using only the following:
gl_FragColor = texture2D(sampler0, gl_TexCoord.st);
For some reason, when I pass the texture like this:
glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 256, 256, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, getSlice(0)); //getSlice(0) basically returns the pointer to the buffer with the 3D image
The result is ok, I can see a slice of the image occupying the whole cube I use as base (I’d like to add an image here but again, I can’t or the post gets denied…)
However, when I pass the texture like this:
glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 512, 256, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, getSlice(0));
I expect in the result to see 2 slices of the image in 3D, one next to other. However, 4 slices are displayed (undistorted and occupying 1/4 of the face of the cube).
This makes no sense for me :S How can this be possible? I mean, I only gave the space for 2 slices but 4 are shown :S
Do you have any idea of what can be happening here? I’m almost sure it has to be a very basic error but I don’t have a clue…
Thanks for everything and sorry for the looong post.