This is how I would translate the D3D code to OpenGL (2.0)
[pascal]
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, tex);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL _CLAMP);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL _CLAMP);
glUseProgram(SHADER_TEX);
glDrawArrays(GL_TRIANGLE_FAN,0,2);
[/pascal]

The code above assumes that tex is the texture identifier,
SHADER_TEX is theshader id.

The call to glActiveTexture sets the texture stage - it corresponds to first parameter in SetTexture and setTextureStageState.

glDrawArrays function is the closest equivalent of DrawPrimitiveUP I can think of.

This is a literal translation, I assumed that you have created the texture, the shader prgram and prepared the geometry data to be rendered with glDrawArrays.