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 7527031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:00:11+00:00 2026-05-30T04:00:11+00:00

I set the format with: QGLFormat format = QGLFormat(QGL::DoubleBuffer | QGL::DepthBuffer); setFormat(format); in the

  • 0

I set the format with:

QGLFormat format = QGLFormat(QGL::DoubleBuffer | QGL::DepthBuffer);
setFormat(format);

in the constructor.

Then in initializeGL I set depthTesting on.

void VoxelEditor::initializeGL()
{
    glClearDepth(2000.0);                                   // Enables Clearing Of The Depth Buffer
    glEnable(GL_DEPTH_TEST);                            // Enables Depth Testing
    glDepthFunc(GL_LESS);                               // The Type Of Depth Test To Do
    glShadeModel(GL_SMOOTH);                            // Enables Smooth Color Shading
    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);  // Really Nice Perspective Calculations
}

In paintGL I clear the depth buffer.

void VoxelEditor::paintGL()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    draw();
}

I remember it used to work with less vertices, so it might be that I’m using too many for the depthbuffer to handle(?).
I have 32*32*32 voxels which are drawn half of most of the time, so 98304 quads.

Depth testing however still does not work and shows the quads in order of execution.

  • 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-30T04:00:12+00:00Added an answer on May 30, 2026 at 4:00 am

    so it might be that I’m using too many for the depthbuffer to handle(?).

    The depth buffer is oblivious to vertices. All it sees are incoming fragments and it doesn’t matter how many.

    void VoxelEditor::initializeGL()
    {
        glClearDepth(2000.0);   // Enables Clearing Of The Depth Buffer
    

    This line does not enable clearing. It set’s the value the depth buffer is cleared to. The value must be in the range 0…1. The clearing depth is in Normalized Device Coordinates, i.e. after modelview, projection and homogenous divide have been applied. The default value is 1.

        glEnable(GL_DEPTH_TEST);  // Enables Depth Testing
        glDepthFunc(GL_LESS);     // The Type Of Depth Test To Do
        glShadeModel(GL_SMOOTH)  // Enables Smooth Color Shading
        glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);  // Really Nice Perspective Calculations
    

    No, that’s not what is does. Perspective is just a linear transformation and always works the same. What it means is, that texture coordinates may be interpolated in a different way to enhance quality.

    }
    

    I always recommend putting those calls in the drawing functions, because they don’t initialize anything. They set drawing state. OpenGL is a state machine and a important rule of state machines is, that either you keep track of their state or you must put them into a known state whenever you’re going to use it.

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

Sidebar

Related Questions

I have a Date Time field in a report with format set to 31/01/2000
How do you globally set the date format in ASP.NET? My local machine and
So I can set the date format on the Calendar Extender to it displays
i would like to set the date format of all the dates in my
I would like to set some initial variables (like format compact and the current
I have a set od Excel (2003) sheets saved as .xlt format. Now ,how
How can I set an A4 document in landscape (horizontal) format in iTextSharp?
I've been set the 'challenge' of converting seconds to format as the Days,Minutes and
At the top of my tex document, I set my sourcecode listing format by
I have successfully trained a classifier (bayesnet) and constructed a test set (ARFF-format), which

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.