0

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, 


};

`

Edited by dakerao

3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by MandrewP
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.