こんにちは私はテクスチャ(.bmp画像)をロードしようとしています...
デバッグすると、ロードされていることがわかります...しかし、画面には何も表示されません!これが私のコードです:
int front_ID = Terrain.LoadGLTextures(@"C:\Users\Ruba\Desktop\our project graphic2\our project graphic\images\top.bmp");
int back_ID = Terrain.LoadGLTextures(@"C:\Users\Ruba\Desktop\our project graphic2\our project graphic\images\top.bmp");
int right_ID = Terrain.LoadGLTextures(@"C:\Users\Ruba\Desktop\our project graphic2\our project graphic\images\top.bmp");
int left_ID = Terrain.LoadGLTextures(@"C:\Users\Ruba\Desktop\our project graphic2\our project graphic\images\top.bmp");
int top_ID = Terrain.LoadGLTextures(@"C:\Users\Ruba\Desktop\our project graphic2\our project graphic\images\top.bmp");
int down_ID = Terrain.LoadGLTextures(@"C:\Users\Ruba\Desktop\our project graphic2\our project graphic\images\top.bmp");
Terrain.draw_skybox(520, front_ID, back_ID, right_ID, left_ID, top_ID, down_ID);
およびメソッド(draw_skybox):
public static void draw_skybox(float size, int front, int back, int right, int left, int up, int bottom)
{
float scale = 1; // important
Gl.glPushMatrix();
Gl.glScalef(size, size, size);
//Front Face
//Gl.glEnable(Gl.GL_CULL_FACE);
Gl.glCullFace(Gl.GL_BACK);
Gl.glBindTexture(Gl.GL_TEXTURE_2D, front);
Gl.glBegin(Gl.GL_QUADS);
Gl.glNormal3f(0, 0, 1);
Gl.glTexCoord2d(0, 0); Gl.glVertex3f(-0.5f, -0.5f, -0.5f);
Gl.glTexCoord2d(1, 0); Gl.glVertex3f(0.5f, -0.5f, -0.5f);
Gl.glTexCoord2d(1, 1); Gl.glVertex3f(0.5f, 0.5f, -0.5f);
Gl.glTexCoord2d(0, 1); Gl.glVertex3f(-0.5f, 0.5f, -0.5f);
Gl.glEnd();
//Gl.glCullFace(Gl.GL_BACK);
// Gl.glDisable(Gl.GL_CULL_FACE);
//Back Face
Gl.glBindTexture(Gl.GL_TEXTURE_2D, back);
Gl.glBegin(Gl.GL_QUADS);
Gl.glNormal3f(0, 0, -1);
Gl.glTexCoord2d(1, 0); Gl.glVertex3f(-0.5f, -0.5f, 0.5f);
Gl.glTexCoord2d(0, 0); Gl.glVertex3f(0.5f, -0.5f, 0.5f);
Gl.glTexCoord2d(0, 1); Gl.glVertex3f(0.5f, 0.5f, 0.5f);
Gl.glTexCoord2d(1, 1); Gl.glVertex3f(-0.5f, 0.5f, 0.5f);
Gl.glEnd();
//right face
Gl.glBindTexture(Gl.GL_TEXTURE_2D, right);
Gl.glBegin(Gl.GL_QUADS);
Gl.glNormal3f(1, 0, 0);
Gl.glTexCoord2d(0, 0); Gl.glVertex3f(0.5f, -0.5f, -0.5f);
Gl.glTexCoord2d(0, 1); Gl.glVertex3f(0.5f, 0.5f, -0.5f);
Gl.glTexCoord2d(1, 1); Gl.glVertex3f(0.5f, 0.5f, 0.5f);
Gl.glTexCoord2d(1, 0); Gl.glVertex3f(0.5f, -0.5f, 0.5f);
Gl.glEnd();
//Left Face
Gl.glBindTexture(Gl.GL_TEXTURE_2D, left);
Gl.glBegin(Gl.GL_QUADS);
Gl.glNormal3f(-1, 0, 0);
Gl.glTexCoord2d(1, 0); Gl.glVertex3f(-0.5f, -0.5f, -0.5f);
Gl.glTexCoord2d(1, 1); Gl.glVertex3f(-0.5f, 0.5f, -0.5f);
Gl.glTexCoord2d(0, 1); Gl.glVertex3f(-0.5f, 0.5f, 0.5f);
Gl.glTexCoord2d(0, 0); Gl.glVertex3f(-0.5f, -0.5f, 0.5f);
Gl.glEnd();
//Top Face
Gl.glBindTexture(Gl.GL_TEXTURE_2D, up);
Gl.glBegin(Gl.GL_QUADS);
Gl.glNormal3f(0, 1, 0);
Gl.glTexCoord2d(0, 0); Gl.glVertex3f(-0.5f, 0.5f, -0.5f);
Gl.glTexCoord2d(1, 0); Gl.glVertex3f(0.5f, 0.5f, -0.5f);
Gl.glTexCoord2d(1, 1); Gl.glVertex3f(0.5f, 0.5f, 0.5f);
Gl.glTexCoord2d(0, 1); Gl.glVertex3f(-0.5f, 0.5f, 0.5f);
Gl.glEnd();
//Bottom Face
Gl.glBindTexture(Gl.GL_TEXTURE_2D, bottom);
Gl.glBegin(Gl.GL_QUADS);
Gl.glNormal3f(0, -1, 0);
Gl.glTexCoord2d(0, 0); Gl.glVertex3f(-0.5f, -0.5f, -0.5f);
Gl.glTexCoord2d(1, 0); Gl.glVertex3f(0.5f, -0.5f, -0.5f);
Gl.glTexCoord2d(1, 1); Gl.glVertex3f(0.5f, -0.5f, 0.5f);
Gl.glTexCoord2d(0, 1); Gl.glVertex3f(-0.5f, -0.5f, 0.5f);
Gl.glEnd();
Gl.glPopMatrix();
}
public static void draw_skybox(float size, int front, int back, int right, int left, int up, int bottom)
{
float scale = 1; // important
Gl.glPushMatrix();
Gl.glScalef(size, size, size);
//Front Face
//Gl.glEnable(Gl.GL_CULL_FACE);
//Gl.glCullFace(Gl.GL_BACK);
Gl.glBindTexture(Gl.GL_TEXTURE_2D, front);
Gl.glBegin(Gl.GL_QUADS);
Gl.glNormal3f(0, 0, 1);
Gl.glTexCoord2d(0, 0); Gl.glVertex3f(-0.5f, -0.5f, -0.5f);
Gl.glTexCoord2d(1, 0); Gl.glVertex3f(0.5f, -0.5f, -0.5f);
Gl.glTexCoord2d(1, 1); Gl.glVertex3f(0.5f, 0.5f, -0.5f);
Gl.glTexCoord2d(0, 1); Gl.glVertex3f(-0.5f, 0.5f, -0.5f);
Gl.glEnd();
//Gl.glCullFace(Gl.GL_BACK);
// Gl.glDisable(Gl.GL_CULL_FACE);
//Back Face
Gl.glBindTexture(Gl.GL_TEXTURE_2D, back);
Gl.glBegin(Gl.GL_QUADS);
Gl.glNormal3f(0, 0, -1);
Gl.glTexCoord2d(1, 0); Gl.glVertex3f(-0.5f, -0.5f, 0.5f);
Gl.glTexCoord2d(0, 0); Gl.glVertex3f(0.5f, -0.5f, 0.5f);
Gl.glTexCoord2d(0, 1); Gl.glVertex3f(0.5f, 0.5f, 0.5f);
Gl.glTexCoord2d(1, 1); Gl.glVertex3f(-0.5f, 0.5f, 0.5f);
Gl.glEnd();
//right face
Gl.glBindTexture(Gl.GL_TEXTURE_2D, right);
Gl.glBegin(Gl.GL_QUADS);
Gl.glNormal3f(1, 0, 0);
Gl.glTexCoord2d(0, 0); Gl.glVertex3f(0.5f, -0.5f, -0.5f);
Gl.glTexCoord2d(0, 1); Gl.glVertex3f(0.5f, 0.5f, -0.5f);
Gl.glTexCoord2d(1, 1); Gl.glVertex3f(0.5f, 0.5f, 0.5f);
Gl.glTexCoord2d(1, 0); Gl.glVertex3f(0.5f, -0.5f, 0.5f);
Gl.glEnd();
//Left Face
Gl.glBindTexture(Gl.GL_TEXTURE_2D, left);
Gl.glBegin(Gl.GL_QUADS);
Gl.glNormal3f(-1, 0, 0);
Gl.glTexCoord2d(1, 0); Gl.glVertex3f(-0.5f, -0.5f, -0.5f);
Gl.glTexCoord2d(1, 1); Gl.glVertex3f(-0.5f, 0.5f, -0.5f);
Gl.glTexCoord2d(0, 1); Gl.glVertex3f(-0.5f, 0.5f, 0.5f);
Gl.glTexCoord2d(0, 0); Gl.glVertex3f(-0.5f, -0.5f, 0.5f);
Gl.glEnd();
//Top Face
Gl.glBindTexture(Gl.GL_TEXTURE_2D, up);
Gl.glBegin(Gl.GL_QUADS);
Gl.glNormal3f(0, 1, 0);
Gl.glTexCoord2d(0, 0); Gl.glVertex3f(-0.5f, 0.5f, -0.5f);
Gl.glTexCoord2d(1, 0); Gl.glVertex3f(0.5f, 0.5f, -0.5f);
Gl.glTexCoord2d(1, 1); Gl.glVertex3f(0.5f, 0.5f, 0.5f);
Gl.glTexCoord2d(0, 1); Gl.glVertex3f(-0.5f, 0.5f, 0.5f);
Gl.glEnd();
//Bottom Face
Gl.glBindTexture(Gl.GL_TEXTURE_2D, bottom);
Gl.glBegin(Gl.GL_QUADS);
Gl.glNormal3f(0, -1, 0);
Gl.glTexCoord2d(0, 0); Gl.glVertex3f(-0.5f, -0.5f, -0.5f);
Gl.glTexCoord2d(1, 0); Gl.glVertex3f(0.5f, -0.5f, -0.5f);
Gl.glTexCoord2d(1, 1); Gl.glVertex3f(0.5f, -0.5f, 0.5f);
Gl.glTexCoord2d(0, 1); Gl.glVertex3f(-0.5f, -0.5f, 0.5f);
Gl.glEnd();
Gl.glPopMatrix();
}
私を助けてください