GLProgramming.com

home :: about :: development guides :: irc :: forums :: search :: paste :: links :: contribute :: code dump

-> Click here to learn how to get live help <-


New Paste :: Recent Pastes:: No Line Numbers


A Paste by MystikIce
1
 
bool GLFX::Init()
{
    glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glEnable(GL_TEXTURE_2D);
    glEnable(GL_DEPTH_TEST);
    glEnable(GL_CULL_FACE);
    glCullFace(GL_BACK);
    glShadeModel(GL_SMOOTH);
    GLuint texture[1];
    glGenTextures(1, &texture[0]);
    if(texture[0] == 0)
        MessageBox(NULL, "glGenTexture Failed", NULL, MB_OK);
    glBindTexture(GL_TEXTURE_2D, texture[0]); 
    pSandTexture = glImg->loadBmp("C:\\Work\\My Projects\\OpenGl_Terrain_Engine\\sandTex.bmp");
    if(!pSandTexture)
        MessageBox(NULL, "Could Not Load File", NULL, MB_OK);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 128, 128, 0, GL_RGB, GL_UNSIGNED_BYTE, pSandTexture);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
    return true;
}