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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:54:11+00:00 2026-06-10T14:54:11+00:00

I most recently had great progress in getting Vertex buffer objects to work. So

  • 0

I most recently had great progress in getting Vertex buffer objects to work.
So I moved on to Element arrays and I figured with such implemented I could then load vertices and face data from an obj.

I’m not too good at reading files in c++ so I wrote a python doc to parse the obj and write 2 separate txts to give me a vertex array and face indices and pasted them directly in my code. Which is like 6000 lines but it works (without compiling errors).
And Here’s what it looks like

.

I think they’re wrong. I’m not sure. The order of the vertices and faces aren’t changed just extracted from the obj because I don’t have normals or textures working for buffer objects yet. I kinda do if you look at the cube but not really.

Heres the render code

void Mesh_handle::DrawTri(){
    glBindBuffer(GL_ARRAY_BUFFER,vertexbufferid);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,elementbufferid);
    int index1=glGetAttribLocation(bound_program,"inputvertex");
    int index2=glGetAttribLocation(bound_program,"inputcolor");
    int index3=glGetAttribLocation(bound_program,"inputtexcoord");

    glEnableVertexAttribArray(index1);
    glVertexAttribPointer(index1,3,GL_FLOAT,GL_FALSE,9*sizeof(float),0);

    glEnableVertexAttribArray(index2);
    glVertexAttribPointer(index2,4,GL_FLOAT,GL_FALSE,9*sizeof(float),(void*)(3*sizeof(float)));

    glEnableVertexAttribArray(index3);
    glVertexAttribPointer(index3,2,GL_FLOAT,GL_FALSE,9*sizeof(float),(void*)(7*sizeof(float)));

    glDrawArrays(GL_TRIANGLE_STRIP,0,elementcount);
    //glDrawElements(GL_TRIANGLE_STRIP,elementcount,GL_UNSIGNED_INT,0);
}

My python parser which just writes the info into a file: source

The object is Ezreal from League of Legends

I’m not sure if I’m reading the faces wrong or if their not even what I thought they were. Am I suppose to use GL_TRIANGLE_STRIP or something else. Any hints or request more info.

  • 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-10T14:54:12+00:00Added an answer on June 10, 2026 at 2:54 pm

    First, as Andreas stated, .obj files use 1-based indices, so you need to convert them to 0-based indices.

    Second:

    glDrawArrays(GL_TRIANGLE_STRIP,0,elementcount);
    //glDrawElements(GL_TRIANGLE_STRIP,elementcount,GL_UNSIGNED_INT,0);
    

    Unless you did some special work to turn the face list you were given in your .obj file into a triangle strip, you don’t have triangle strips. You should be rendering GL_TRIANGLES, not strips.

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

Sidebar

Related Questions

I've recently had to work with an application where most tables don't reference each
I've had the thrill recently of developing web service applications. Most of my experience
I do most of my development in Java and C++ but recently had to
There has been a debate at work recently at the most efficient way to
I recently had to struggle with one installation project (which uses most popular product
I have an application that used to work. I recently had a full reinstall
I want to retrieve the most recently added record from CoreData. I was wondering
I have never come across this issue but most recently I noticed that a
I am trying to get the unique ID for the most recently added value
I need to gain access to the list of most recently used programs and

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.