1
0
Fork 0

Modified Files:

src/Cockpit/panel.cxx src/Main/renderer.cxx: Make sure we run on
	texture unit 0 in plain opengl code.
This commit is contained in:
frohlich 2007-01-06 13:51:47 +00:00
parent bb78043480
commit b8dffe05ab
2 changed files with 43 additions and 1 deletions

View file

@ -378,6 +378,8 @@ FGPanel::draw(osg::State& state)
panelStateSet->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF);
state.pushStateSet(panelStateSet.get());
state.apply();
state.setActiveTextureUnit(0);
state.setClientActiveTextureUnit(0);
FGLight *l = (FGLight *)(globals->get_subsystem("lighting"));
sgCopyVec4( panel_color, l->scene_diffuse().data());
@ -390,6 +392,9 @@ FGPanel::draw(osg::State& state)
if (_bg != 0) {
state.pushStateSet(_bg.get());
state.apply();
state.setActiveTextureUnit(0);
state.setClientActiveTextureUnit(0);
glBegin(GL_POLYGON);
glTexCoord2f(0.0, 0.0); glVertex2f(WIN_X, WIN_Y);
glTexCoord2f(1.0, 0.0); glVertex2f(WIN_X + _width, WIN_Y);
@ -398,11 +403,17 @@ FGPanel::draw(osg::State& state)
glEnd();
state.popStateSet();
state.apply();
state.setActiveTextureUnit(0);
state.setClientActiveTextureUnit(0);
} else {
for (int i = 0; i < 4; i ++) {
// top row of textures...(1,3,5,7)
state.pushStateSet(_mbg[i*2].get());
state.apply();
state.setActiveTextureUnit(0);
state.setClientActiveTextureUnit(0);
glBegin(GL_POLYGON);
glTexCoord2f(0.0, 0.0); glVertex2f(WIN_X + (_width/4) * i, WIN_Y + (_height/2));
glTexCoord2f(1.0, 0.0); glVertex2f(WIN_X + (_width/4) * (i+1), WIN_Y + (_height/2));
@ -411,9 +422,15 @@ FGPanel::draw(osg::State& state)
glEnd();
state.popStateSet();
state.apply();
state.setActiveTextureUnit(0);
state.setClientActiveTextureUnit(0);
// bottom row of textures...(2,4,6,8)
state.pushStateSet(_mbg[i*2+1].get());
state.apply();
state.setActiveTextureUnit(0);
state.setClientActiveTextureUnit(0);
glBegin(GL_POLYGON);
glTexCoord2f(0.0, 0.0); glVertex2f(WIN_X + (_width/4) * i, WIN_Y);
glTexCoord2f(1.0, 0.0); glVertex2f(WIN_X + (_width/4) * (i+1), WIN_Y);
@ -422,6 +439,9 @@ FGPanel::draw(osg::State& state)
glEnd();
state.popStateSet();
state.apply();
state.setActiveTextureUnit(0);
state.setClientActiveTextureUnit(0);
}
}
@ -467,6 +487,9 @@ FGPanel::draw(osg::State& state)
state.popStateSet();
state.apply();
state.setActiveTextureUnit(0);
state.setClientActiveTextureUnit(0);
// Draw yellow "hotspots" if directed to. This is a panel authoring
// feature; not intended to be high performance or to look good.
@ -480,6 +503,9 @@ FGPanel::draw(osg::State& state)
state.pushStateSet(hotspotStateSet.get());
state.apply();
state.setActiveTextureUnit(0);
state.setClientActiveTextureUnit(0);
glPushAttrib(GL_ENABLE_BIT);
glDisable(GL_COLOR_MATERIAL);
@ -492,6 +518,9 @@ FGPanel::draw(osg::State& state)
state.popStateSet();
state.apply();
state.setActiveTextureUnit(0);
state.setClientActiveTextureUnit(0);
}
}
@ -1019,6 +1048,9 @@ FGTexturedLayer::draw (osg::State& state)
transform();
state.pushStateSet(_texture.getTexture());
state.apply();
state.setActiveTextureUnit(0);
state.setClientActiveTextureUnit(0);
glBegin(GL_POLYGON);
if (_emissive) {
@ -1036,6 +1068,9 @@ FGTexturedLayer::draw (osg::State& state)
glEnd();
state.popStateSet();
state.apply();
state.setActiveTextureUnit(0);
state.setClientActiveTextureUnit(0);
}
}

View file

@ -124,7 +124,8 @@ public:
{
state.pushStateSet(getStateSet());
state.apply();
state.setActiveTextureUnit(0);
state.setClientActiveTextureUnit(0);
if((fgGetBool("/sim/atc/enabled"))
|| (fgGetBool("/sim/ai-traffic/enabled")))
@ -176,6 +177,8 @@ public:
{
state.pushStateSet(getStateSet());
state.apply();
state.setActiveTextureUnit(0);
state.setClientActiveTextureUnit(0);
glPushAttrib(GL_ALL_ATTRIB_BITS);
glPushClientAttrib(~0u);
@ -531,6 +534,10 @@ FGRenderer::update( bool refresh_camera_settings ) {
|| fgGetBool("sim/sceneryloaded-override");
if ( idle_state < 1000 || !scenery_loaded ) {
if (sceneView.valid() && sceneView->getState()) {
sceneView->getState()->setActiveTextureUnit(0);
sceneView->getState()->setClientActiveTextureUnit(0);
}
// still initializing, draw the splash screen
glPushAttrib(GL_ALL_ATTRIB_BITS);
glPushClientAttrib(~0u);