Hello all I have a bunch of aggregate elements within my array.

This array is for vertex positions in OpenGL.

and I need to make a switch without having to bind more data to OpenGL.

To do this I must put an if statement within the array or a booleon variable = true;

How would I go about doing this without it giving me weird errors

Here is my array

`

  //GUI Cordinates x y z w - NEEDS TEX CORDS
  static const GLfloat GUIVertices[] = { 

///////////////////////////////////////////////////////////////////////////
//ToolBar
1.0f,  1.0f,  0.0f, 1.0f, 1.0f, 0.0f, 
-1.0f,  1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 
-1.0f,  0.94f, 0.0f, 1.0f, 0.0f, 1.0f, 
1.0f,   0.94f, 0.0f, 1.0f, 1.0f, 1.0f,   

//////////////////////////////////////////////////////////////////////////

//Main ToolBox
// x     y       z   w       X    Y
1.0f, -1.0f,   0.0f, 1.0f, 1.0f, 0.0f, 
-1.0f,-1.0f,   0.0f, 1.0f, 0.0f, 0.0f, 
-1.0f,-0.94f,  0.0f,1.0f, 0.0f, 1.0f, 
1.0f, -0.94f,  0.0f,1.0f, 1.0f, 1.0, 


};

`

Recommended Answers

All 2 Replies

that makes no sense at all -- you can't put if statements in arrays. Post an example of what you want to do.

If you want to avoid "weird" errors, then don't do anything weird. LOL. You can't put program code into arrays, but you can put pointers to program code (functions) into arrays. The functions pointed to can contain the if statements.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.