What's the best way to deal with this structure please?


I’ve got a little project in mind, but I want to make sure I start off on the right foot.

I’m going to have an unknown number of textures, each with an associated number of vertices (not just the ones for the texture ‘frame’) and other objects.

In C++, straight Javascript, any of a number of other languages I’d have no problem. But this is my first foray into GPU territory & I really don’t know the best way to go about it.

I could have quite a few textures on the go, with constant transformations, and as far as I understand things so far they need to be stored & manipulated down on the graphics hardware, but as far as I can tell I can’t keep everything on it. For one thing, I’ve been having no luck finding any type of dynamic array that I can use in WebGL. Javascript - no problem.

In my mind, what I’m thinking of is a varying sized bag/list/array of objects sitting up in the CPU, each object having a link to the visual(texture/vertex) part of itself which lives down in the GPU, where all transformations get done as well.
All of the examples / tutorials I’ve found however, have all of the visual elements stuffed into one fixed size array which gets (I think) compiled into the program which gets run on the GPU.

Can anyone - in very plain English - correct my misconceptions & suggest a structure that will let me do what I want to do?

Then I can start building with the easiest bits first & slowly learn the rest - but all the while knowing where each bit I’m working on fits into the picture.

Many thanks for reading,

Good place to start webgl: http://learningwebgl.com/blog/
Good place to start c++ opengl: http://nehe.gamedev.net/tutorial/lessons_01__05/22004/

I suggest webgl if youre starting out with coding because javascript is very loosely typed and is easy to understand.

I suggest c++ opengl if you are not a newbie at coding because c++ is compiled and faster than javascript… but it has strong coding and is a little difficult to get your foot into.

Good luck matey!

Many thanks Jimmy :smiley: