PDA

View Full Version : NVOPENGL Exception



ironduke
05-06-2000, 09:49 AM
I load a dib like so.

void COpenGLView::InitGL()
{

glClearColor(0.0f, 0.0f, 0.0f, 1.0f) ;
glShadeModel(GL_FLAT);
glEnable(GL_DEPTH_TEST);

int x,y;
for(x =0; x < 128; x++)
{
for(y = 0; y < 128; y++)
{
Tile[x][y][0] = 255;
Tile[x][y][1] = 0;
Tile[x][y][2] = 0;
Tile[x][y][3] = 255;

}
}


SubTile = auxDIBImageLoad("E:\\Program Files\\VC++
Projects\\OpenGL\\res\\Wheat.bmp");


glPixelStorei(GL_UNPACK_ALIGNMENT,1);

glGenTextures(1,&texName);
glBindTexture(GL_TEXTURE_2D, texName);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

glTexImage2D(GL_TEXTURE_2D,0, GL_RGBA,
128,128,0,GL_RGBA,GL_UNSIGNED_BYTE,Tile);

glTexSubImage2D(GL_TEXTURE_2D,
0,64,64,SubTile->sizeX,SubTile->sizeY,GL_RGBA,GL_UNSIGNED_BYTE,SubTile->data
);

}

I then draw a quad

void COpenGLView: http://www.opengl.org/discussion_boards/ubb/biggrin.gifrawGL()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);


glEnable(GL_TEXTURE_2D);
glBegin(GL_QUADS);
glTexCoord2i(0,0); glVertex2i(10,10);
glTexCoord2i(0,1); glVertex2i(138,10);
glTexCoord2i(1,1); glVertex2i(138,138);
glTexCoord2i(1,0); glVertex2i(10,138);
glEnd();
glFlush();
glDisable(GL_TEXTURE_2D);
}

I keep getting the same exception each time I run the app?

suggestions please!