Page 1 of 1

cube and sphere mapping OpenGL

Posted: Tue Aug 08, 2006 08:04
by Percy Camilo
Hello i have a problem , wen enable a cube or sphere mapping (in the render function of my GL class) all the gui stuff dissapear buttons, frames, scrools, etc... why is that ?

this code is the problem: for example i enable the sphere mapping with :
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
is happend too with
glEnable(GL_TEXTURE_CUBE_MAP);

Code: Select all

...
  glLoadIdentity();
  glRotatef(30.0, 1.0, 0.0, 0.0);

  glEnable(GL_CULL_FACE);
  glEnable(GL_TEXTURE_2D);
  glBindTexture(GL_TEXTURE_2D, pctatex.mTexture2D[0]);
    glEnable(GL_TEXTURE_GEN_S);
    glEnable(GL_TEXTURE_GEN_T);
    glEnable(GL_TEXTURE_GEN_R);
  glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP);
  glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP);
  glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP);

  pctaVector uN;
...


please i need help.

Posted: Tue Aug 08, 2006 08:12
by lindquist
I could imagine that disabling these states before calling renderGUI would solve the problem.
The OpenGL renderer does not take the entire OpenGL state machine into account. Not all states are initialised. IIRC cube map texturing has higher priority than 2d texturing, thus it will override any texturing CEGUI tries to do.
You could let us know what glDisable calls you have to do before renderGUI, and we will add them to the OpenGL renderer.

Posted: Tue Aug 08, 2006 08:33
by Percy Camilo
SOLVED
Yes you're right , thx a lot
:wink:
i disable all the textures target , i do this add glDisable in the end of my render func:


Code: Select all

void CSomeGLClass::render()
{
   .......
  glRotatef(30.0, 1.0, 0.0, 0.0);

  glEnable(GL_CULL_FACE);
  glEnable(GL_TEXTURE_2D);
  glBindTexture(GL_TEXTURE_2D, pctatex.mTexture2D[0]);
    glEnable(GL_TEXTURE_GEN_S);
    glEnable(GL_TEXTURE_GEN_T);
    glEnable(GL_TEXTURE_GEN_R);
  glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP);
  glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP);
  glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP);

  pctaVector uN;
  ..................
  ..................
  ..................
  .................. 

// this solved the problem
  glDisable(GL_CULL_FACE);
  glDisable(GL_TEXTURE_2D);
  glDisable(GL_TEXTURE_GEN_S);
  glDisable(GL_TEXTURE_GEN_T);
  glDisable(GL_TEXTURE_GEN_R);
}


thx again
bytes