Thank you for reply.
after i adjust my code about initialise EGL, the code seems not work quite well. so i ddcide to post more detail here, i hope it’s helpful to find the fault.
//the Initialise EGL routine are listed below.
void InitGL()
{
EGLint attribList[ ] =
{ EGL_BUFFER_SIZE, 32,
EGL_DEPTH_SIZE, 16,
EGL_NONE
};
switch( iWindow.DisplayMode() )
{
case( EColor4K ) :
{ attribList[1] = 12; break; }
case( EColor64K ):
{ attribList[1] = 16; break; }
case( EColor16M ):
{ attribList[1] = 24; break; }
default: attribList[1] = 32;
}
EGLint numConfigs;
EGLint majorVersion;
EGLint minorVersion;
iGldisplay = eglGetDisplay( EGL_DEFAULT_DISPLAY );
if( iGldisplay == EGL_NO_DISPLAY )
{
User::Panic( _L("GL No Display"),0 );
}
if( !eglInitialize( iGldisplay, &majorVersion, &minorVersion ) )
{
User::Panic( _L("GL Init"), 0 );
}
if( !eglChooseConfig( iGldisplay, attribList, &iGlconfig, 1, &numConfigs ) )
{
User::Panic(_L("GL Config"), 0 );
}
iGlcontext = eglCreateContext( iGldisplay, iGlconfig, NULL, NULL );
if( iGlcontext==0 )
{
User::Panic( _L("GL Context"), 0 );
}
iGlsurface = eglCreateWindowSurface( iGldisplay, iGlconfig, &iWindow, NULL );
if( iGlsurface==0 )
{
User::Panic( _L("GL Surface"), 0 );
}
eglMakeCurrent( iGldisplay, iGlsurface, iGlsurface, iGlcontext );
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glEnable(GL_CULL_FACE);
glEnable(GL_MULTISAMPLE);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glShadeModel(GL_FLAT);
glDisable( GL_LIGHTING );
TSize Size = iWindow.Size();
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glFrustumf( -1.f, 1.f, -1.f, 1.f, 3.f, 100.f );
glMatrixMode( GL_MODELVIEW );
glViewport( 0, 0, Size.iWidth, Size.iHeight );
}
//The render routine code is also listed
void Render()
{
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glLoadIdentity();
iCamera.Apply();
RenderForSelect();
ReadPixelFromPt(x, y);
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
RenderNormal();
}
/* the ReadPixelFromPt(x, y) is for framebuff readback. it’s just as mentioned before.
*/
the problem is that when the renderNormal()s not called, then the result is quite good. but if renderNormal()s called, everything goes wrong. and the different bettween the render and renderForSelect() is only the former function actives the texture mapping.
so the question is why the renderNorml influence ReadPixelFromPt so much.
what’s more, the alpha value is still 0xFF.