PDA

View Full Version : Display list problem



HamsterofDeath
02-01-2003, 08:51 AM
the following code draws a forest

gl.glPushMatrix();

gl.glActiveTextureARB(GL_TEXTURE2_ARB);
gl.glDisable(GL_TEXTURE_2D);
gl.glActiveTextureARB(GL_TEXTURE3_ARB);
gl.glDisable(GL_TEXTURE_2D);
gl.glActiveTextureARB(GL_TEXTURE4_ARB);
gl.glDisable(GL_TEXTURE_2D);

gl.glActiveTextureARB(gl.GL_TEXTURE1_ARB);
gl.glDisable(gl.GL_TEXTURE_2D);

gl.glActiveTextureARB(gl.GL_TEXTURE0_ARB);
gl.glBindTexture(gl.GL_TEXTURE_2D, texture[woodTex]);
gl.glDisable( GL_TEXTURE_GEN_S);
gl.glDisable( GL_TEXTURE_GEN_T);

landscape.getForest().drawForestTrees(gl,glu,null, texture,treeTex,0);
landscape.getForest().drawForestTrees(gl,glu,null, texture,treeTex,1);

gl.glBindTexture(gl.GL_TEXTURE_2D, texture[woodTex2]);
landscape.getForest().drawForestTrees(gl,glu,null, texture,treeTex,2);

landscape.getForest().drawForestTrees(gl,glu,null, texture,treeTex,3);
gl.glPopMatrix();


gl.glPushMatrix();


gl.glActiveTextureARB(gl.GL_TEXTURE1_ARB);
gl.glDisable(gl.GL_TEXTURE_2D);

gl.glActiveTextureARB(gl.GL_TEXTURE0_ARB);
gl.glEnable(gl.GL_TEXTURE_2D);

gl.glDisable(gl.GL_CULL_FACE);

gl.glAlphaFunc(gl.GL_GREATER,0.1f); // Set Alpha Testing (disable blending)
gl.glEnable(gl.GL_ALPHA_TEST); // Enable Alpha Testing (disable blending)


gl.glBindTexture(gl.GL_TEXTURE_2D, texture[7]);
landscape.getForest().drawForest2DObjects(gl,glu,n ull,texture,treeTex,0);
landscape.getForest().drawForest2DObjects(gl,glu,n ull,texture,treeTex,1);
landscape.getForest().drawForest2DObjects(gl,glu,n ull,texture,treeTex,2);
landscape.getForest().drawForest2DObjects(gl,glu,n ull,texture,treeTex,3);

gl.glDisable(gl.GL_ALPHA_TEST);
gl.glPopMatrix();


if i put this in a displaylist, the texturing is not correct (drawForest just uses glvertex/texcoord commands)
whats wrong ?