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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:16:35+00:00 2026-05-24T04:16:35+00:00

I have an interleaved array format and I want to render it in open

  • 0

I have an interleaved array format and I want to render it in open GL. It is an array of triangles. The vertices are 2D floating points and the colors are RGBA floating points. That is, a single triangle is layed out this this:

{vertex.x, vertex.y, color.red, color.blue, color.green, color.alpha, ...}

Where all number are single precision floats. I’m having trouble figuring out what the format parameter should be. It seems like it needs V2F and C4F, but not such symbolic constant exists. Can I OR them together like (GL_V2F | GL_C4F)?

UPDATE: I’m using python and pyopengl. tibur‘s answer is very clear and if I were programming in C I’d be done. The python code is pretty similar, but I have to have to offset the pointer into the color array by 8 bytes. I don’t know how to do this in python or if it even can be done:

strideInBytes = 24
interleavedBytes = array.tostring()
glVertexPointer(2, GL_FLOAT, 24, interleavedBytes) 
glColorPointer(4, GL_FLOAT, 24, interleavedBytes) #The first color actually starts on the 9th byte

I need to avoid copying the entire interleaved array. Otherwise I could just make a copy and chop off the first 8 bytes.

  • 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-24T04:16:36+00:00Added an answer on May 24, 2026 at 4:16 am

    No, you can’t OR them. You need to use the following code:

    glVertexPointer(2, GL_FLOAT, 6*sizeof(float), ptr);
    glColorPointer(4, GL_FLOAT, 6*sizeof(float), ((unsigned char*)ptr) + 2 * sizeof(float));
    glEnableClientState(GL_VERTEX_ARRAY);
    glEnableClientState(GL_COLOR_ARRAY);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using a VBO with an interleaved array to render a obj (model format)
My vertices are interleaved in a numpy array (dtype = float32) like this: ...
I want to convert from pcm 44100khz 16bit signed 2 channel interleaved (packed) format
I want to have a diagnostic log that is produced by several tasks managing
I have an inline assembler loop that cumulatively adds elements from an int32 data
I have a complex hierarchy of objects that we can represent, for illustration purpose,
I have a 16 bit value with its bits interlaced. I want to get
I have an API that gives me PCM wave data: http://msdn.microsoft.com/en-us/library/ff966424.aspx The byte[] buffer
I have a list of text files file1.txt, file2.txt, file3.txt .. filen.txt that I
Let's say I am using a custom GLSL shader that uses a special interleaved

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.