OpenGL blending/drawing help

Started by
5 comments, last by clint8565 19 years, 4 months ago
I have a slight dilema
//draw everything
void Render(NewEarth &Earth, NewShot &Shot)
{
  glClearColor (0.0f, 0.0f, 0.0f, 0.0f);
  glClear (GL_COLOR_BUFFER_BIT);
  
  glBindTexture(GL_TEXTURE_2D, tex.texID);
  glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
  glBegin(GL_QUADS);
  glTexCoord2f(0.0f, 0.0f); glVertex2f(Shot.loc[0]-2.0f, Shot.loc[1]-2.0f);
  glTexCoord2f(0.0f, 1.0f); glVertex2f(Shot.loc[0]-2.0f, Shot.loc[1]+2.0f);
  glTexCoord2f(1.0f, 1.0f); glVertex2f(Shot.loc[0]+2.0f, Shot.loc[1]+2.0f);
  glTexCoord2f(1.0f, 0.0f); glVertex2f(Shot.loc[0]+2.0f, Shot.loc[1]-2.0f);
  glEnd();
  
  /*
  glBegin(GL_LINES);
  glColor3f(0.0f,0.5f,0.0f);
  for(int a=0;a<800;a++)
  {
    glVertex2f(Earth.Dirt[a].loc[0],Earth.Dirt[a].loc[1]);
    glVertex2f(Earth.Dirt[a].loc[2],Earth.Dirt[a].loc[3]);
  }      
  glEnd();
  for(int a=0;a<128;a++)
  {
    if(Earth.Chunk[a].active)
    {
      glBegin(GL_POINTS);
      glColor3f(0.0f,0.5f,0.0f);
      glVertex2f(Earth.Chunk[a].loc[0],Earth.Chunk[a].loc[1]);
      glEnd();
    }  
  }
  */
  
  glFlush();
}
This is my render function, right now there are two part, the commented and not commented. The uncommented part draws a little bullet texture and the commented part draws the ground and dirt particles. Now they both work seperately, I can use one or the other, but as soon as I try to run them together they blink on for a second and then the whole screen goes black. But I'm greedy and want them both to mingle peacefully, any suggestions?
Advertisement
little help please
put glColor3f(1,1,1) some where at the top befor u render anything
ok I did that, and I removed the comments now when I run it it shows the bullet isntead of nothing, but the ground and ground particles still don't show up
Try uping the distance of your far clipping plane.
how doI do that?
nevermind I got the answer from a different post, thanks anyways especially mike (if I take out that line of code my bullet turns into a nearly invisible really dark gray spot)

This topic is closed to new replies.

Advertisement