Line and Texture colours mixing!
Sorry, but I was unsure of a way to describe this problem correctly in the subject section as I am pretty tired and have been at it all day. Anywa I have a problem. I have drawn a background grid and have placed textured cubes on the grid. Anyway, the colour of the grid always ends up being the Colour of the texture and the texture also seems to get shaded with the colour hat the line is ''supposed'' to be.
The following is the function that I use to draw the grid, and draw the cubes.
void display_func(void)
{
int xindex, yindex;
// clear the buffers (screens)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// render the game grid
glPushMatrix();
// draw the blocks from the grid data
for (xindex = 0; xindex < 14; xindex++){
for (yindex = 0; yindex < 22; yindex++){
switch (grid[(yindex * 14) + xindex])
{
case 1:
drawCube(-7.0f + xindex, 11.0f - (yindex + 1), -32.0f);
break;
default:
break;
}
}
}
glPopMatrix();
glPushMatrix();
draw_grid(-0.5f,-0.5f,-16.0f); // (draws lines to form grid)
glPopMatrix();
}
Can anyone help me out. I am obviously doing something wrong. I think it is because I am setting the colour in the drawGrid function then that colour is staying loaded forever and is being drawn onto m textures and vice versa. How do I get rid of the colour once i have used it?
Cheers,
MeeZ
MeeZ
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement