Is this bad OpenGL?

Hi list, I am using OpenGL in a Basic environment, not C. OpenGL is an API, not a language, so there is no reason why it should act differently from inside any other environment, so I hope you are not put off by Basic. In Basic, capitialisation doesn’t count, and you don’t need to end lines with ; and you don’t need to use brackets for command paramters, only for function parameters.

I have some code that doesn’t seem to work when put inside one glNewList, but does when split up into more than one glNewList. It could be that it works because when I’m splitting it up, my code automatically does glEnd and various other things to make the split up lists make sense.

I copy and pasted the lines

Anyhow, is there something wrong with this code? What goes wrong is that the pyramid is drawn in the wrong place (gltranslate doesn’t make any changes), and although textures are enabled and one is bound, the pyramid is drawn without a texture, just in white.

glnewList LastGLList, GL_COMPILE_AND_EXECUTE
glpushMatrix //Begin Pyramid
glTranslatef x, y, z
glPushAttrib GL_ALL_ATTRIB_BITS
glEnable GL_TEXTURE_2D
texture.Tex.Use
//a Basic method, so you don’t see the API equivilient
//, I think its like glbindtexture
glbegin ptype
many { gltexcoord2d tx, ty
glvertex3f x, y, z}
glpopMatrix
glPopAttrib
glend //End Pyramid
// For some reason, the pyramid is drawn with no texture and in
// the wrong place

glPushAttrib GL_ALL_ATTRIB_BITS //The rest of this code works fine
glEnable GL_TEXTURE_2D
texture.Tex.Use
glCullFace cullFace
glbegin ptype
many { gltexcoord2d tx, ty
glvertex3f x, y, z}
glPopAttrib
glend
glPushAttrib GL_ALL_ATTRIB_BITS
glEnable GL_TEXTURE_2D
texture.Tex.Use
glEnable GL_BLEND
glDepthMask false
glDisable GL_LIGHTING
glBlendFunc blendsourceFunc, blenddestFunc
glcolor4d 1.0, 1.0, 1.0, blendamount
glbegin ptype
many { gltexcoord2d tx, ty
glvertex3f x, y, z}
many { gltexcoord2d tx, ty
glvertex3f x, y, z}
glEnd
glPopAttrib
glEndList

Can someone help me with this? Its wierd, because if I turn compile and execute to only compile, then it works fine! (I have to disable some tests with glIsEnabled though)

Can someone explain this? The problem is that with compile and execute, that the texture doesn’t show up.