3D Wrong sides of 3D cube being drawn

Discussion in 'Programming' started by SilentX, Feb 8, 2017.

  1. SilentX

    SilentX Guest

    I'm working on a new 3D puzzle game for iOS.

    When running the game on my iPad, it appears that sometimes, a few sides of a 3D cube, which are drawn last, will appear in front of other sides, even if they are on the opposite side of the cube. Each cube is made of 6 primitives.

    Here is how one side of a cube is created:
    d3d_model_primitive_begin(obj_landscape1.model[2],pr_trianglefan)
    d3d_model_vertex_texture(obj_landscape1.model[2],x,y,zed2,0,0)
    d3d_model_vertex_texture(obj_landscape1.model[2],x,y,zed1,1,0)
    d3d_model_vertex_texture(obj_landscape1.model[2],x+sprite_width,y,zed1,1,1)
    d3d_model_vertex_texture(obj_landscape1.model[2],x+sprite_width,y,zed2,0,1)
    d3d_model_primitive_end(obj_landscape1.model[2])

    Here is the code to draw all the primitives within a model:
    d3d_model_draw(model[2],0,0,0,sprite_get_texture(spr_block1,0))

    This is very similar to a problem I recently had, except that instead of some sides not being drawn at all, I have sides on the opposite side of a cube being drawn over the top of the side closest to the camera.

    It displays perfectly on my laptop, but incorrectly on my iPad.

    I'm not sure how to fix this, as there will always be a side of the cube drawn last, with the camera on the opposite side.

    I have game maker studio 1.4.1598 installed. When using the latest version of game maker, I had other issues when exporting the game in Xcode, so I rolled back to this version.

    I have attached 2 images demonstrating the issue.
     

    Attached Files:

    Last edited by a moderator: Feb 8, 2017
  2. flyingsaucerinvasion

    flyingsaucerinvasion Member

    Joined:
    Jun 20, 2016
    Posts:
    2,169
    do you have backside culling turned on?

    are you using the z buffer?
     
  3. SilentX

    SilentX Guest

    I am using d3d_set_culling(true)
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice