blending issue

Started by
0 comments, last by zaneski13 14 years, 4 months ago
I'm currently making a level editor. The main idea behind it is, you take a grid, move it somewhere in 3D, click somewhere on the grid, draw current tile where ever you clicked relative to the grid. The way I'm handling this is when I get a mouse click event I get its position and then translate that 2D pos into a 3D pos. It works fine. The only limitation is that I need the mouse over something that was drawn on the screen. (because I use glReadPixel() to aid in getting the mouse's 3D pos ) So in order to get a valid 3D mouse press on the grid I need something underneath (just barely) the grid. I figured that I'd draw a quad the same size as the grid with a color that is equal to the glClearColor value. This gives the illusion that only the grid is being drawn. It works fine, even when I move the grid up in the y axis but what I'm trying to do next is giving me problems. I'd like to see whats underneath the grid. I tried calling glEnable(GL_BLEND); with the following blend funcs: GL_SRC_ALPHA,GL_ONE GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA GL_ZERO GL_ZERO and some others. with blending enabled I set the color to black with an alpha of 0, but when I moved the grid up in y and something in my level was under the grid, I couldn't see it. I thought glBlend would do the trick! but apariently not!!??? Oh, I also tried glDisable(GL_DEPTH_TEST) but that made the GetMouse3D func not work because it wasn't picking up the zbuffer, BECAUSE THERE WASN'T ANY Any suggestions?
Advertisement
Oh, NeverMind! Read an article and learned that full opacity objects must be drawn first. Changed the order of how I drew objects and everything worked fine.

This topic is closed to new replies.

Advertisement