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

  • Home
  • SEARCH
  • 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 8149187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:47:55+00:00 2026-06-06T14:47:55+00:00

I have a cloud model and it continues to go behind the background scene

  • 0

I have a cloud model and it continues to go behind the background scene (called as “wall” in code). How do i bring the cloud model to the front so that it never goes behind?

Code is as follows:

public class RocketBlast extends DemoWrapper implements InputProcessor, ApplicationListener {
private static final Vector2 GRIDSIZE = new Vector2(16, 16);


FloorGrid floor;
private DecalBatch decalBatch;
private SpriteBatch spriteBatch2d;
private GroupStrategy strategy;
// private DecalSprite[] walls = new DecalSprite[5];
private DecalSprite wall;
private ArrayList<DecalSprite> walls = new ArrayList<DecalSprite>();

private MeshHelper cloud;
private DecalSprite shadow;
// camera
private Camera cam;
private GuOrthoCam oCam;
private GuPerspCam pCam;
private String camType = "ortho";
private boolean debugRender = true;
private Vector2 screenSize;
private Vector2 last = new Vector2(0, 0);
private Builder builder;

@Override
public void create() {
    Gdx.gl.glEnable(GL10.GL_DEPTH_TEST);
    Gdx.gl10.glDepthFunc(GL10.GL_LESS);

    builder = new Builder();
    builder.addIslands();


    screenSize = new Vector2(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

    oCam = new GuOrthoCam(screenSize.x, screenSize.y, GRIDSIZE);
    oCam.position.set(8, 1, -17);
    oCam.setTargetObj(builder.target);

    pCam = new GuPerspCam(50, 50, 50);

    cam = oCam; 

    floor = new FloorGrid(GRIDSIZE);

    String objfile = "data/volumetric_cloud_tutorial.obj";
    cloud = new MeshHelper(objfile);
    cloud.scale(0.5f, 0.5f, 0.5f);
    cloud.setPos(1, 1f, 5);
    cloud.setColor(1, 1, 0);
    cloud.setMotion(1,0, 0, 0.02f);
    cloud.setTexture();



    addWalls();

    // batches
    strategy = new CameraGroupStrategy(cam);
    decalBatch = new DecalBatch(strategy);
    spriteBatch2d = new SpriteBatch();
    spriteBatch2d.enableBlending();


    Gdx.input.setInputProcessor(this);
}



private ArrayList<DecalSprite> addWalls() {

    wall = new DecalSprite().build("data/i.png");
    wall.sprite.rotateY(90);
    wall.sprite.setPosition(GRIDSIZE.x, 1, 8);
    wall.sprite.setDimensions(17, 2);
    walls.add(wall);

    return walls;
}




@Override
public void render() {
    GL10 gl = Gdx.app.getGraphics().getGL10();
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);

    float delta = Gdx.graphics.getDeltaTime();

    cam.update();
    cam.apply(gl);

    setUpLighting(gl);



    gl.glColor4f(0, 1, 0, 1f);
    floor.render(gl, GL10.GL_LINE_STRIP);
    gl.glColor4f(1, 0, 0, 1f);

    for (DecalSprite oneWall : walls) {
        decalBatch.add(oneWall.sprite);
    }

    cloud.update(delta);
    cloud.render(gl, GL10.GL_TRIANGLES);




    //decalBatch.add(shadow.sprite);

    decalBatch.flush();

    cam.update();
    cam.apply(gl);
    // decalBatch.add(player.sprite);
    decalBatch.flush();

    cam.update();
    cam.apply(gl);

    // turn off lighting for 2d sprites
    gl.glDisable(GL10.GL_LIGHTING);

    gl.glPopMatrix();

    oCam.handleKeys();

}



}
  • 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-06T14:47:57+00:00Added an answer on June 6, 2026 at 2:47 pm

    Depth just means ‘the distance from the camera’.

    I’m not a libgdx expert, but it looks like it’s using the X-Z plane to draw the world, and it’s treating the camera as on the ‘Y’ axis looking downward.

    If that’s the case (please correct me if I’m wrong), then you need your clouds to have a Y-value greater (nearer to the camera) than your background.

    Try setting the wall’s Y position to something like ‘-1’, and the cloud to something like ‘0’, and see if that works. You can layer other objects by adjusting the depth as well.

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

Sidebar

Related Questions

I have a belonging model that allows user to post objects to be sold
We have cloud-hosted (RackSpace cloud) Ruby and Java apps that will interact as follows:
We have a cloud hosting account that gives us 2GB of memory and 3GHZ
I have a Tag cloud that i need to style. Unfortunately it has no
In my tag cloud I have urls that look like this ../search.php?query=cat&select=all ../search.php?query=the cat&select=all
I have a tag cloud that I'm including on nearly all of the views
I have a model called Business , and I want to save Business.all into
I have mysql DB on cloud linux server. I am able to connect db
I have been reading up on Cloud computing on here and still not getting
I have a series of Rackspace Cloud Files CDN URLs stored which reference an

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.