//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();
}
OpenGL blending/drawing help
I have a slight dilema
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?
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement