Jump to content
  • Advertisement
Sign in to follow this  
clint8565

OpenGL blending/drawing help

This topic is 5113 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
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)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!