Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. OpenGL help (URGENT)

OpenGL help (URGENT)

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialgraphicsgame-devhelpquestion
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ArFuk
    wrote on last edited by
    #1

    I had created a 3D cube so that it can rotates around a point. However, when the cube is drew, some faces will disappear in certain angle while other diappear in another angle. Can anyone please help why this occured ?? Or can anyone give some example on how to programme it?? Thanks very much!! :((:((:((:((

    A 1 Reply Last reply
    0
    • A ArFuk

      I had created a 3D cube so that it can rotates around a point. However, when the cube is drew, some faces will disappear in certain angle while other diappear in another angle. Can anyone please help why this occured ?? Or can anyone give some example on how to programme it?? Thanks very much!! :((:((:((:((

      A Offline
      A Offline
      Alexander M
      wrote on last edited by
      #2

      i think that is a problem of the normals. a normal tells a face in what direction to reflect the light, so when u look at its back, u won't see it anymore. remove the calls to glNormal3x and it should be fine. Don't try it, just do it! ;-)

      A 1 Reply Last reply
      0
      • A Alexander M

        i think that is a problem of the normals. a normal tells a face in what direction to reflect the light, so when u look at its back, u won't see it anymore. remove the calls to glNormal3x and it should be fine. Don't try it, just do it! ;-)

        A Offline
        A Offline
        ArFuk
        wrote on last edited by
        #3

        In fact, the problem now is that, The six faces of the cube just like have their own 'priority', such that one specific face will always on top and then the second and third.... according to the 'priority'.... can this be solved ?? Thanks very much... :((:((:((:((:((:((

        Z 1 Reply Last reply
        0
        • A ArFuk

          In fact, the problem now is that, The six faces of the cube just like have their own 'priority', such that one specific face will always on top and then the second and third.... according to the 'priority'.... can this be solved ?? Thanks very much... :((:((:((:((:((:((

          Z Offline
          Z Offline
          ZoogieZork
          wrote on last edited by
          #4

          Sounds like you have depth buffering disabled. You'll need to have a depth buffer created when you're creating the OpenGL display, you'll need to enable depth testing (with glEnable(GL_DEPTH_TEST)), and you'll need to clear the depth buffer at each frame (glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)). - Mike

          A 1 Reply Last reply
          0
          • Z ZoogieZork

            Sounds like you have depth buffering disabled. You'll need to have a depth buffer created when you're creating the OpenGL display, you'll need to enable depth testing (with glEnable(GL_DEPTH_TEST)), and you'll need to clear the depth buffer at each frame (glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)). - Mike

            A Offline
            A Offline
            ArFuk
            wrote on last edited by
            #5

            I have checked the depth testing is enabled and the buffer was clear each time... I doubt if the GLUPERSPECTIVE will also cause this problem... Can anyone tell me how to use this function ?? I have looked at the document of the GLUPERSPECTIVE but I dont think it really help... BTW, what does "clipping plane" mean ?? Thanks very much again and again... :((:((:((:((:((:((

            A 1 Reply Last reply
            0
            • A ArFuk

              I have checked the depth testing is enabled and the buffer was clear each time... I doubt if the GLUPERSPECTIVE will also cause this problem... Can anyone tell me how to use this function ?? I have looked at the document of the GLUPERSPECTIVE but I dont think it really help... BTW, what does "clipping plane" mean ?? Thanks very much again and again... :((:((:((:((:((:((

              A Offline
              A Offline
              AORD
              wrote on last edited by
              #6

              Have you checked the order of your points (glVertex's) defining the cube? You could also try NeHe: http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=05

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups