Basically, my problem appears to be with the libraries. Since 3D textures are not supported under OpenGL 1.1 (I believe that’s the release that MSVC++ 6.0 compiles to…), I can’t seem to use them at all.
Once I get can get 3D textures to work at all, I’m going to attempt to display what is essentially a 3D probability density function, with the texture applied to multiple quads. I really don’t expect any problems with this, once I get over the intial library/include file hurdles.
Currently I’m attempting to use the include files that come with nVidia’s OpenGL SDK. Here are some snippets of pertinent code that I’m attempting to use right now:
#include <stdlib.h> #include <math.h> #include <windows.h> #include <GL/glut.h> #include <GL/glext.h> #define GLH_EXT_SINGLE_FILE //I copied this stuff from one of the nVidia demos. #include <glh_extensions.h> #include <glh_linear.h> #include <nvparse.h> using namespace glh; //lots of code...but this is the pertinent portion: //Load texture glGenTextures(1, &texid); glBindTexture(GL_TEXTURE_3D, texid); glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); // glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST); // glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_GENERATE_MIPMAP_SGIS, GL_TRUE); glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_REPEAT); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glTexImage3D(GL_TEXTURE_3D, 0, GL_LUMINANCE, size, size, size, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, img);
Again, the latter part was essentially copied from an nVidia demo (procedural 3D textures). The program fails at the glTexImage3D function call. With the above settings (I have used different ones…with different errors), I get an error "referenced memory at “0x00000000"”. If I instead use include files more like:
#include <stdlib.h> #include <math.h> #include <windows.h> #include <glh_extensions.h>
…and add opengl32.lib (along with any or all of the lib’s with the NVSDK) to the list of library files to use, I get an unresolved external error on the glTexImage3D function call. Notice that I also cut out a bunch of include files…I don’t think I use most of 'em at all.
Now, I figure since the code at top was copied (nearly) directly from the proctex3d demo at nVidia’s site, you’d think it would work, as the code in that project compiles and runs just fine (And yes, I checked to make sure the invalid address wasn’t the pointer img).
Any ideas as to what they could be doing in the nVidia demo that I’m not doing?