0

I have OpenGL method :

glStencilFillPathInstancedNV(6, glyphBase,
                                 GL_UNSIGNED_BYTE, "OpenGL",
                                 GL_PATH_FILL_MODE_NV, 0xFF,
                                 GL_TRANSLATE_2D_NV, xtranslate);

Where xtranslate should be an array of GLfloat where each consecutive pair of numbers represent 2 dim vector. In my app the data structure representing xtranslate is:

std::vector<glm::vec2> xtranslate;

How do I get the data pointer to this structure so that it's valid to be passed into the above mentioned method as GLFloat*

Should I manually "flatten" the structure into array or there is some trickier solution?

Glm is the OpenGL template only math library.

Btw , I have seen that OpenSceneGraph API has such a method for its vector structures , but I couldn't find the source for the implementation.

6
  • Is using C++11 allowed for you? Commented May 1, 2013 at 11:54
  • How hard does it crash if you just go with &(xtranslate[0].x)? :) Commented May 1, 2013 at 12:49
  • Just because I believe such an attempt will be useless I even not going to try it ;) Because it will get only a single pointer to a single float in the first vec2... Commented May 1, 2013 at 12:52
  • I'm pretty sure every implementation of std::vector stores its contents in an array. I would believe glm::vec2 is nothing more than a struct with two floats. If the float used by vec2 is the same as GLfloat, it might work. Commented May 1, 2013 at 13:02
  • stackoverflow.com/questions/7856364/… Commented May 1, 2013 at 13:10

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.