I am new to OpenGL and I don’t know exactly how to write to GPU. I create textures by glTexImage2D and render them and also render lines etc using glBegin…glEnd.
I read about glDrawArrays and glDrawElements increase performance. My textures are square in shape in tile form (think of chess table). Each line, path, polygon may have different color, width and stipple pattern. How can I use vertex arrays in this context?
I suggest you have a look at display lists first, these are easier to use and can improve performance a lot, what you do is that you “record” a set of OpenGL commands and save that “recording” in memory that the GPU can access fast, then when you “play” back the display list it will be executed just as if you would have executed the same set of opengl function calls.
Just make a google serach for opengl tutorials on display lists or look at any of the web sites you can find links to on this web site to get you started.
This will of course only work if you have static geometry that does not change all the time (you can transform the geometry before you call a display list though), so if you have very dynamic geometry you might want to have a closer like at other solutions.
I think display lists will increase performance greatly. I did my textures so, already it began working faster. I have another question: Can I put boolean comparisons inside the list that will operate during execution, not compilation.
Originally posted by Bumbala: I think display lists will increase performance greatly. I did my textures so, already it began working faster. I have another question: Can I put boolean comparisons inside the list that will operate during execution, not compilation.
Not possible.