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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:52:30+00:00 2026-05-27T05:52:30+00:00

I have an OpenGL application, where I fill a two dimensional int List with

  • 0

I have an OpenGL application, where I fill a two dimensional int List with data, I also Logging the size every time I put data in it. It works grate, there is 236 row. But after I call the method later in the Log it gives me back that the size is 0.
Here is how the structur looks like:

Main.java

...
onDrawFrame(GL10 gl) {
    if (first == true) {
        // the data comes from another method
        myList.setData(x, y); // I send the the data for the List
                          // and also log the List size, which at the end is 236
        first = false;
    }

    myList.check(); // It just Logs the List size, which gives back 0
}
...

List.java

private List<int[]> dataS = new ArrayList<int[]>();

public void setData(int x, int y) {
    dataS.add(new int[] { x, y });
    Log.i("size", "size: " + dataS.size());
}

public void check() {
    Log.i("check", "check: " + dataS.size());
}

I just can’t understand what is the problem with it, hope someone can help me.

Whole code:

Main.java

public class Main extends GLSurfaceView implements Renderer {

public void drawGame(GL10 gl) {
    if (firstGameFrame == true) {
        tMap.setMap();
        firstGameFrame = false;
    }

    collision.check();
}   
}   

Map.java

public class Map {

public void setMap() {

    // map1 is an int map1[][] = {{1,0,1}, {1,1,1}, {0,0,1}}; - of course there are more data in it

    for (int z = 0; z < map1.length; z++) {
            for (int x = 0; x < map1[z].length; x++) {
                if (map1[z][x] == 1) {
                    collision.getWall((x*2) - 23, (z * 2) - 27);
                }
            }
        }
}
}

Collision.java

public class Collision {

private List<Integer[]> wallCoord = new ArrayList<Integer[]>();

public void getWall(int x, int y) {
    wallCoord.add(new Integer[] { x, y });
    Log.i("getwall", "getwall " + x + " " + y + " size " + wallCoord.size());       
}

public void check() {
    Log.i("coords", "size: " + wallCoord.size());
}
}
  • 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-27T05:52:31+00:00Added an answer on May 27, 2026 at 5:52 am

    Ok, Without your code, I can just help this, just declare

    private List<int[]> dataS = new ArrayList<int[]>();
    

    as a globally,

    and then use dataS through out your class.. and make sure you never initialized dataS again anywhere.

    I think you are using different collision class object in Map.java and Main.java file, You are set the value using collision object from Map.java class and checking it size with Main’s collision class.(If am not wrong).

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

Sidebar

Related Questions

I have a simple OpenGL application where I have 2 objects displayed on screen:
I'm writing a basic planet viewer OpenGL Perl application, just for fun. I have
I have an application with an OpenGL window as a child window of the
I have a simple iPhone application which uses OpenGL ES (v1) to draw a
I have an application that is built against OpenSceneGraph (2.6.1) and therefore indirectly OpenGL.
I have created an iPhone application based on an OpenGL view. Now I would
I have got a very, very strange problem in my C++ OpenGL application. I
I have an opengl application that loads a dxf and draws it on the
I've got a multithreaded OpenGL application using PBOs for data transfers between cpu and
I have a problem with lighting in my OpenGL application. When one of the

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.