我写了一个vb.net函数来打开一个光栅文件。功能如下:
class ActiveTexturePool {
static const GLint maximumActiveTextures = 16; // number of maximum units
GLint currentActiveTextureID[maximumActiveTextures]; // have the container
ActiveTexturePool() { // a constructor is needed to reset the data
memset(currentActiveTextureID, 0, sizeof(currentActiveTextureID)); // sets all to zero
}
class ActiveTextureObject {
public:
GLuint textureID;
GLenum activeTextureID;
void generateNew() {
useActive();
glGenTextures(1, &activeTextureID);
}
void useActive() {
glActiveTexture(activeTextureID);
}
void bind() {
glBindTexture(GL_TEXTURE_2D, textureID);
}
void bindAndUseActive() {
useActive();
bind();
}
};
ActiveTextureObject getNewTextureObject() {
ActiveTextureObject toReturn;
for(GLint i=0; i<maximumActiveTextures; i++) {
if(currentActiveTextureID[i] == 0) {
GLenum activeTexture = GL_TEXTURE0 + i;
currentActiveTextureID[i] = activeTexture;
toReturn.activeTextureID = activeTexture;
return toReturn;;
}
}
return NULL; // the pool is full, you may not create another active texture!
}
void recycleTexture(ActiveTextureObject texture) { // remove from the pool
for(GLint i=0; i<maximumActiveTextures; i++) {
if(currentActiveTextureID[i] == texture.activeTextureID) {
currentActiveTextureID[i] = 0;
texture.activeTextureID = 0;
// you may also delete the data here but that should most likely be handled by the ActiveTextureObject
break;
}
}
}
};
以上函数在TryCast语句中抛出以下错误:
调试器附加到w3wp exe但未配置为调试此未处理的异常。要调试此表达式,请分离当前调试器。
我也在谷歌搜索过,一些建议是在IIS应用程序池中启用32位,但启用此功能也不会使代码正常工作