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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:25:54+00:00 2026-05-27T00:25:54+00:00

I d like to parse an .obj file. My parser is working good, but

  • 0

I d like to parse an .obj file. My parser is working good, but my displaying is not good.
Obj file is here

my code is:

    public ObjModelParser parse() {
        long startTime = System.currentTimeMillis();

        InputStream fileIn    = resources.openRawResource(resourceID);
        BufferedReader buffer = new BufferedReader(new InputStreamReader(fileIn));
        String line="";

        Log.e("model loader", "Start parsing object " + resourceID);

        try {
            while ((line = buffer.readLine()) != null) {
                StringTokenizer parts = new StringTokenizer(line, " ");
                int numTokens = parts.countTokens();
                if (numTokens == 0) continue;

                String part = parts.nextToken();

                if (part.equals(VERTEX)) {
                    Log.e("v ", line);

                    vertices.add(Float.parseFloat(parts.nextToken()));
                    vertices.add(Float.parseFloat(parts.nextToken()));
                    vertices.add(Float.parseFloat(parts.nextToken()));
....

and my displaying code is:

draw that model with TRIANGLE_STRIP and gl.glDrawArrays(rendermode, 0, coords.length/dimension);

enter image description here

What is the mistake here?

edited: file here to show what is my good coords from my program for a cube, and what is from .obj file, that never show

Thanks, Leslie

  • 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-27T00:25:54+00:00Added an answer on May 27, 2026 at 12:25 am

    You are trying to draw using TRIANGLE_STRIP instead of TRIANGLES, did you do the work and put the necessary degenerate triangles for STRIP to work ?

    If you did put in those degenerate triangles I would bet a problem there, could we look at the data output from your parser ? say just the first 10 triangles…

    If you didn’t create the degenerate triangles or don’t know what that is just change the draw from TRIANGLE_STRIP to TRIANGLES, also using a triangle strip with a model like this limits some trick you can make with the normals, to produce better looking graphics. (if your going with simple or cartoony look ignore this part).

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

Sidebar

Related Questions

I'd like to parse a simple, small XML file using python however work on
I have an XML file which I'd like to parse into a non-XML (text)
I'm trying to write a 3D OBJ file parser for the iPhone/iPad and am
I want to parse the text line from the Wavefront OBJ file . Currently
I would like to parse a CSV file so that each row is treated
I would like to parse a string such as p1=6&p2=7&p3=8 into a NameValueCollection .
I would like to parse a document using SAX, and create a subdocument from
I would like to parse the values from aspx pages, both what is passed
I'd like to parse an incoming URL into it's component parts for some pre-processing
I'm new to jQuery and would like to parse an XML document. I'm able

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.