c++ - Overlaping rectangels and clipping at the bottom in opengl -


I have to make some 3D figures using OpenGL (Older Versions). I have 3 GL_POLYGON rectangles that are connected to each other and which are different colors.

My problem is that when the final color is added (the last added rectangle) is always on top of other people, for example Cyan is above a pink and yellow, and pink is a yellow color I have also seen that some clippings below the data, which I think is due to gluPerspective () what I am trying to achieve, from Z ++ to the center and Walking through the eyes y + axis (which I think is I I am walking around with Mayab am) and give overlapping and also remove Cliping.

Any idea why this happens and how it is decided?

The code is gone:

  #include & lt; GL / glfw.h & gt; Int main () {int width, height; Int frame = 0; Boil Run = true; GlfwInit (); If (! Glyph OpenVindo (700, 800, 0, 0, 0, 0, GLFW_windows)) {glfwTerminate (); Return 0; } GlfwSetWindowTitle ("GLFW Application"); While (running) {frame ++; GlfwGetWindowSize (and width, and height); Height = height & gt; 0? Height: 1; GlViewport (0, 0, width, height); Glow collar (0.0 F, 0.0F, 0.0F, 0.0F); Glklier (GLCOOLROBUFFARABIT); GlamorousSmod (GL_Project); GlLoadIdentity (); Glue perpetual (65.0 f, (GL float) width / (GL float) height, 1.0 f, 100.0 f); GlamatrixSmod (GLIMDLUF); GlLoadIdentity (); GluLookAt (0.0f, 0.0f, 40.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f); Glottef (frame, 0.0f, 1.0f, 0.0f); GlColor3ub (255,255,0); Globegine (GLOOSOGO); GlVertex3f (5.0f, 0.0f, 0.0f); GlVertex3f (0.0f, 0.0f, 0.0f); GlVertex3f (0.0 f, 10.0 f, 0.0f); GlVertex3f (5.0f, 10.0f, 0.0f); GlEnd (); GlColor3ub (255,0255); Globegine (GLOOSOGO); GlVertex3f (5.0f, 0.0f, -2.0f); GlVertex3f (0.0 f, 0.0 f, -2.0 f); GlVertex3f (0.0 f, 10.0 f, -2.0 f); GlVertex3f (5.0f, 10.0f, -2.0 f); GlEnd (); GlColor3ub (0255255); Globegine (GLOOSOGO); GlVertex3f (5.0f, 0.0f, 0.0f); GlVertex3f (5.0f, 0.0f, -2.0f); GlVertex3f (5.0f, 10.0f, -2.0 f); GlVertex3f (5.0f, 10.0f, 0.0f); GlEnd (); GlfwSwapBuffers (); Its going on!! Gluffgate's (GLFW_KY_SEC) & amp; Amp; GlfwGetWindowParam (GLFW_OPENED);} glfwTerminate (); Return 0; }    

I do not see the depth feature in your code, deep buffer and GL_DEPTH_TEST , if not implemented, the drawing order rule ..


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -