Couple of textures on quads
i have a problem i don't know how to put 2 quads in game loop with textures
i have class to load image:
ILvoid Menu::LoadMenu()
{
ilGenImages(1, &texture);
ilBindImage(texture);
switch(no_pic)
{
case 1:
load = ilLoadImage("data/img/Menu/Starthigh.jpg");
break;
case 2:
load = ilLoadImage("data/img/Menu/Exit_low.png");
break;
}
if(load)
{
wczytallo = ilConvertImage(IL_RGB, IL_UNSIGNED_BYTE);
glGenTextures(1,&zdjecie);
glBindTexture(GL_TEXTURE_2D, zdjecie);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, ilGetInteger(IL_IMAGE_BPP), ilGetInteger(IL_IMAGE_WIDTH),
ilGetInteger(IL_IMAGE_HEIGHT), 0, ilGetInteger(IL_IMAGE_FORMAT), GL_UNSIGNED_BYTE,
ilGetData());
}
ilDeleteImages(1, &textura);
}
And now a main game loop:
finished = 0;
menu_state = 0;
menu.nr_zdjecia = 1;
while (!finished)
{
while (SDL_PollEvent(&event))
{
switch (event.type)
{
case SDL_KEYDOWN:
if (event.key.keysym.sym == SDLK_ESCAPE){
finished = 1;
return 0;
}
}
/////////////////////////////////////////////////////////
/////////MENU/////////////
///Pic 1
glPushMatrix();
menu_state = 1;
glTranslatef(256.0,0.0,0.0);
menu.check_devIL();
menu.init_menu();
menu.Load_menu();
menu.render_menu();
glPopMatrix();
//Pic 2
glPushMatrix();
if(menu.no_pic = 1){
menu.no_pic = 2;
}
menu.LoadMenu();
glTranslatef(256.0, 256.0, 0.0);
menu.render_menu();
menu.no_pic = 3;
glPopMatrix();
}
}
(in rendermenu() i have function to draw quad with texture)
but when i run this i have only one pic (second) and it's still flushing because
game loop is working
I really need help
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement