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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:55:03+00:00 2026-06-13T03:55:03+00:00

In my Android app I need to display a 3D object (that’s no problem),

  • 0

In my Android app I need to display a 3D object (that’s no problem), but the front edges should be solid and the back edges should be dotted. I need to have something like on the picture. How can I achieve it using OpenGL ES 1 or 2?

I have tried the Tim’s idea(using Depth buffer). It works but there are some artefacts like on the pictures, dotted(purple) lines overlap solid(red) lines:

enter image description here enter image description here

It happens because dotted lines(purple colour(GL_GREATER)) are drawn AFTER red lines(GL_LEQUAL).
It there any ideas how to prevent it?

Thank you everyone for helping. Now it looks great!!
enter image description here

  • 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-06-13T03:55:05+00:00Added an answer on June 13, 2026 at 3:55 am

    Here’s a rough outline of what I would do. You’ll need one mesh for the object itself, and another mesh of GL_LINES for the ‘edge lines’ that you want to draw.

    1. Draw the solid mesh into the depth buffer.
    2. Draw your ‘edge mesh’ with a standard shader, such that you get solid lines, but set the depth test to GL_LEQUAL (only draw objects nearer than the depth value.
    3. Draw your edge mesh a second time with a depth test of GL_GREATER. In this pass use a stipple shader to get the dotted line effect (explained further below).

    This might have problems depending on what other objects are in the scene, as you might get dotted lines drawn in the case where the cube is obscured by something else, but maybe that’s not a problem for you or you can somehow cull the mesh if it is obscured.

    For the stipple shader, you can set a texcoord of one vertex of the line to be zero, and another endpoint of the line to be one. Then in your shader you can use a step function similar to suggested by tencent, to reject fragments to create a stipple pattern.

    You can also skip the messing with the depth buffer if you want to calculate yourself which lines are behind the object, though it could be a lot of work with anything more than a cube.

    If you want to use OpenGLES 1 instead of OpenGLES 2, replace the stipple shader with a 1D texture of a stipple pattern, and texture the back lines with that. However I’m not 100% sure you can texture a line in OpenGL, so maybe this won’t work.

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

Sidebar

Related Questions

I need to develop an android app that achieves the following: Create an activity
I'm trying to use a mapview object in my app, but I need to
I am developing an android app in which i need to display images after
My problem is that i have an Android Class project and i need to
In my android app I need to display in a gridview images from a
I use AdMob service to display advertisement in my android app. I need to
In my android app I need to display a text on an image. The
I am now working on an android app in which I need to display
My android app project need to add a new function of saving the click
Android Calendar App I need to be able to implement a view similar to

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.