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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T13:46:52+00:00 2026-06-02T13:46:52+00:00

I am having some difficulty loading in texture coords from the obj file using

  • 0

I am having some difficulty loading in texture coords from the obj file using the GLM library

Using OpenGL 3.3

http://www.cs.manchester.ac.uk/ugt/COMP37111/glm/glm.h
http://www.cs.manchester.ac.uk/ugt/COMP37111/glm/glm.c

I am under the impression that an obj file would have the same number of indexed (none repeated) vertexs as texture coords then the “GLMtriangle: Struct” would contain the vertexs “GLuint tindices[3]” that index the texturecoord array “texcoords”. However the examples I have found do not have an equal number of texture coords to vertexs.

Using the above understanding I try to put all the texture coords in to an array by looping through each GLMtriangle and adding indexed texture coords to an array. To give me a texture coord for every single vertex.

C++ based pseudo code.

for (the number of GLMtriangles)

    t= (the GLMtriangle index ) 

    //vertex0
    rawTextCoords[t] = GLMmodel->texcoords [GLMtriangle.tindices[0]];
    rawTextCoords[t+1] = GLMmodel->texcoords [GLMtriangle.tindices[0]+1];
    //vertex1
    rawTextCoords[t+2] = GLMmodel->texcoords [GLMtriangle.tindices[1]];
    rawTextCoords[t+3] = GLMmodel->texcoords [GLMtriangle.tindices[1]+1];
    //vertex2 
    rawTextCoords[t+4] = GLMmodel->texcoords [GLMtriangle.tindices[2]];
    rawTextCoords[t+5] = GLMmodel->texcoords [GLMtriangle.tindices[2]+1];
od

This is my current output.

glm problem

  • 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-02T13:46:55+00:00Added an answer on June 2, 2026 at 1:46 pm

    Your sample pseudocode at least looks sound.

    Wild guess: you are not passing the proper values to glTexCoordPointer() (or glVertexAttribPointer()). It’s easy to get the size or type values wrong if you type too fast. From your pseudocode size needs to be 2.

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

Sidebar

Related Questions

I am having some difficulty with importing data from a .csv file. I am
im having some difficulty trying to pull out a specific value from a cookie.
Hey, I'm having some difficulty with CSS and IE6 compatibility. URL : http://bit.ly/dlX7cS Problem
I am having some difficulty copying a canvas from my buffer canvas to the
I am having some difficulty in using the jQuery Validator plugin. I have a
I'm having some difficulty using the API function QueueUserAPC . Basically, I created a
I'm having some difficulty embedding an image from the Properties.Resources to a MailMessage, currently
I'm having some difficulty getting my django tests to run properly; I'm using nose,
I am having some difficulty dealing with memory leaks in the following code. Using
Having some difficulty using a variable within an ajax() function. I know it is

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.