Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6828811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:25:36+00:00 2026-05-26T22:25:36+00:00

I am drawing my triangles in a world the triangles in the background but

  • 0

I am drawing my triangles in a world the triangles in the background but when I go behind it the triangle isn’t in the foreground (like it should be).

I put a video on YouTube showing the problem here (make sure you read the description)

EDIT:

//create instance of camera class
mainCamera = [[Camera alloc]init];
//Tell window to log mouse events
[[self window] setAcceptsMouseMovedEvents:YES];
//Timer for updating frames
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:1/30 target:self selector:@selector(redraw) userInfo:nil repeats:YES];
//keep timer running during event tracking
[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSEventTrackingRunLoopMode];
[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSModalPanelRunLoopMode];

glEnable(GL_DEPTH_TEST);
glClearDepth(1.0f);
glShadeModel(GL_SMOOTH);    
glEnable(GL_LINE_SMOOTH);


glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
//self in this case is my view. The code below is getting the size of the view.
gluPerspective(45.0f, [self frame].size.width / [self frame].size.height, 1.0f, 1000.0f);   

glMatrixMode(GL_MODELVIEW);
//creating triangle objects
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:25:37+00:00Added an answer on May 26, 2026 at 10:25 pm

    Did you create your context with a depth buffer?

    Did you activate depth testing with glEnable(GL_DEPTH_TEST);?

    Are you using an appropriate glDepthFunc depth test?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm drawing triangles and they're invisible from the view they should be visible, so
I'm drawing a 3d scene in 5-6 drawcalls, but I have about 60000-65000 triangles
currently im drawing a background, then a transparent triangle into the stencil buffer, then
I draw a triangle using mouse drag. After drawing many different triangles, I wanted
I am drawing a mesh of triangles using glDrawElements and would like to be
My program involves drawing triangles where i click them. There are two classes, Ecad
I'm drawing 2D Polygons, actually I'm drawing lots of triangles and using GLUOrtho2D. I
I am trying to construct an equilateral triangle with the following code, but I
I am drawing non-textured triangles whose alpha is being explicitly set to to 0.5
I've got a textured 4 corner polygon that I'm currently drawing using two triangles

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.