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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:49:35+00:00 2026-05-15T18:49:35+00:00

Here is my issue. I have a std::vector<POINTFLOAT> Which stores verticies. The issue is

  • 0

Here is my issue. I have a std::vector<POINTFLOAT> Which stores verticies. The issue is that Vertex buffer objects take in a pointer to an array of float. Therein lies my problem. I cannot give it an array of pointfloat. Is there a way that I could instead push pointers to the individual components of each vertex without pushing in copies?

basically instead of it being:

vec[0].x
vec[0].y
vec[1].x
vec[1].y

It becomes

newvec[0]
newvec[1]
newvec[2]
newvec[3]

I thought of making a std::vector<float*> but I don’t think opengl would like this. Is there a way to do this without copying data?

Thanks

Instead of having to copy data for point.x, point.y, I want OpenGL to get its data from the original vector so basically when openGL would get vec[0] it would actually get pointvec[0].x but it needs to act like when passing by reference, no pointed members

so Opengl cant do *vec[0]

  • 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-15T18:49:35+00:00Added an answer on May 15, 2026 at 6:49 pm

    You can write something like this, ie you have a std::vector which you fill with vertices, and then you call a function (eg an openGL function) which takes a float*. Is that what you want?

    void some_function(float* data)
    {
    
    }
    
    ...
    
    std::vector<float> vec;
    vec.push_back(1.2); // x1
    vec.push_back(3.4); // y1
    vec.push_back(5.6); // x2
    vec.push_back(7.8); // y2
    
    some_function(&vec[0]);
    

    EDIT: This will also work, because the floats are laid out the same in memory:

    struct POINTFLOAT
    {
        float x;
        float y;
    };
    
    void some_function(float* data)
    {
    
    }
    
    ...
    
    std::vector<POINTFLOAT> vec;
    vec.resize(2);
    vec[0].x = 1.2; // x1
    vec[0].y = 3.4; // y1
    vec[1].x = 5.6; // x2
    vec[1].y = 7.8; // y2
    
    some_function((float*)(&vec[0]));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my issue: I have a std::vector<AguiWidgetBase*> which is used to keep track
Here is my issue, lets say I have a std::vector with ints in it.
Here's the issue: I have 2 data contexts that I would like to do
Here's the issue: I have a list of App names that I want to
Having an issue here that I have tried everything I can think of but
Here's a brief rundown of my issue: I have a JavaScript function that gets
I have some issue with boost::asio::async_read Here's my code void TCPConnection::listenForRead() { boost::asio::async_read(m_socket, boost::asio::buffer(m_inbound_data),
Background I have a container class which uses vector<std::string> internally. I have provided a
Here is what I'm trying to do. I have a std::vector with a certain
Working with Reporting Services 2008 r2. So here's my issue: We have 5 reports

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.