Whats wrong with my code? :(

Hi I was trying to render objects with textures and without in the same scene and the code I wrote came something like

(imagine that I already initialized everything and read the textures,and named(glGentextures) then and defined then(glTexImage2D))

void draw()
{
//first draw the textured triangle
glEnable(GL_TEXTURE_2D);
glBind(GL_TEXTURE_2D,TextureName);
glBegin(GL_TRIANGLE);
glTexCoord2f(…);glVertex3f(…)
glTexCoord2f(…);glVertex3f(…)
glTexCoord2f(…);glVertex3f(…)
glEnd();
glBind(GL_TEXTURE_2D,0);
glDisable(GL_TEXTURE_2D);
//then draw the colored triangle

glBegin(GL_TRIANGLES);
   glColor3f(1,0,0);glVertex3f(...);
   glColor3f(0,1,0);glVertex3f(...);
   glColor3f(0,0,1);glVertex3f(...);
glEnd();

}

I first enable texturing , set the actual texture , and draw the triangle with textures , then I disabled texturing and the use of textured objects and I draw the second triangle. But this doesnt work! When I do this ALL the scene is painted as the last color of the second triangle! Evererything turns blue! Please can anyone enlight-me of whats going on and how to solve this?

-My hat!
Fisban

OpenGL is drawing your textured triangle and if you can not see it do you draw something above it or so is it not in the viewing cone.

If the complete scene is blue, you are too near to the last triangle. It seems to fill the whole view.
If it’s only drawn in blue and not Gouraud shaded red/green/blue, than you have flat shading enabled. Look for glShadeModel(GL_FLAT). Flat shading always takes the last color of each (sub-)primitive, except for polygons where it’s the first color.
OpenGL default is glShadeModel(GL_SMOOTH).

First of all in your code after you have textured the first triangle you then do another glBind(…) which isn’t needed.
Secondly, are your triangles on top of each other-this wouldn’t work. Also if the second untextured triangle is much nearer than the textured then this will hide the textured triangle and may also fill the whole screen. Try changeing the last color of the second untextured triangle and see if the screen colour changes apropriately.
Also try each triangle seperately and see if each work by their selfs.
Hope this works