forked from speed-dreams/speed-dreams-code
Apply patch from Simon.
No segfault when missing tacho/speedo texture. Re #213. git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@2904 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 209339675a96b6de304f23d0aa849cf5c05453f2 Former-commit-id: 2397007bed2ac04f38fa58a18fea5288f0727bf6
This commit is contained in:
parent
08b716bc11
commit
ecfe739b99
1 changed files with 14 additions and 2 deletions
|
@ -805,7 +805,9 @@ cGrBoard::grDispCounterBoard2(tCarElt *car)
|
|||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) ;
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||
glBindTexture(GL_TEXTURE_2D, curInst->texture->getTextureHandle());
|
||||
if (curInst->texture) {
|
||||
glBindTexture(GL_TEXTURE_2D, curInst->texture->getTextureHandle());
|
||||
}
|
||||
glCallList(curInst->CounterList);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
|
@ -840,7 +842,9 @@ cGrBoard::grDispCounterBoard2(tCarElt *car)
|
|||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) ;
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||
glBindTexture(GL_TEXTURE_2D, curInst->texture->getTextureHandle());
|
||||
if (curInst->texture) {
|
||||
glBindTexture(GL_TEXTURE_2D, curInst->texture->getTextureHandle());
|
||||
}
|
||||
glCallList(curInst->CounterList);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
|
@ -1206,6 +1210,9 @@ void grInitBoardCar(tCarElt *car)
|
|||
|
||||
/* Load the Tachometer texture */
|
||||
curInst->texture = (ssgSimpleState*)grSsgLoadTexState(param);
|
||||
if (curInst->texture == 0) {
|
||||
curInst->texture = (ssgSimpleState*)grSsgLoadTexState("rpm8000.png");
|
||||
}
|
||||
|
||||
FREEZ(grFilePath);
|
||||
|
||||
|
@ -1264,7 +1271,12 @@ void grInitBoardCar(tCarElt *car)
|
|||
param = GfParmGetStr(handle, SECT_GROBJECTS, PRM_SPEEDO_TEX, "speed360.rgb");
|
||||
sprintf(buf, "drivers/%s/%d;drivers/%s;cars/%s;data/textures", car->_modName, car->_driverIndex, car->_modName, car->_carName);
|
||||
grFilePath = strdup(buf);
|
||||
|
||||
curInst->texture = (ssgSimpleState*)grSsgLoadTexState(param);
|
||||
if (curInst->texture == 0) {
|
||||
curInst->texture = (ssgSimpleState*)grSsgLoadTexState("speed360.rgb");
|
||||
}
|
||||
|
||||
free(grFilePath);
|
||||
cleanup[nstate] = curInst->texture;
|
||||
nstate++;
|
||||
|
|
Loading…
Reference in a new issue