VERTEX ARRAYS
I''m declaring a global array (floats) like this:
float *mesh;
later on I malloc it and give it some values.
mesh = (float *)malloc(numverts*3);
then I set it up as a vertex array:
glEnableClientState(GL_VERTEX_ARRAY);
specify the data:
glVertexPointer(3, GL_FLOAT, 0, mesh);
and draw it with
glDrawArrays(GL_TRIANGLE_STRIP, 0, numverts);
but as soon as I get to glDrawArrays() the whole thing craps itself...
no compile time errors/warnings...
am I not setting up the mesh pointer right?
please! anyone!!
thanks
_________________________________________
I used to be indecisive. Now I''m not so sure...
_________________________________I used to be indecisive. Now I'm not so sure...
Looks ok. What video card do you have? You could also specify what crapping itself means.
The fanatic is incorruptible: if he kills for an idea, he can just as well get himself killed for one; in either case, tyrant or martyr, he is a monster.
--EM Cioran
Opere Citato
The fanatic is incorruptible: if he kills for an idea, he can just as well get himself killed for one; in either case, tyrant or martyr, he is a monster.
--EM Cioran
Opere Citato
"... we should have such an empire for liberty as she has never surveyed since the creation ..."Thomas Jefferson
Your malloc looks to be incorrect.
You''re asking it to malloc (numverts * 3) bytes. When what you want to say is malloc numverts * 3 * sizeof(float) bytes.
Try this:
- Synchronized
You''re asking it to malloc (numverts * 3) bytes. When what you want to say is malloc numverts * 3 * sizeof(float) bytes.
Try this:
|
- Synchronized
Its better to use new than malloc.
Try this
mesh = new float[numverts*3];
when your done,
delete [] mesh;
no type casting etc. (I assume you''re using C++ because of the type-cast)
Feel free to email me.
Try this
mesh = new float[numverts*3];
when your done,
delete [] mesh;
no type casting etc. (I assume you''re using C++ because of the type-cast)
Feel free to email me.
[email=JValentine_13@hotmail.com]contact[/email]
Well, now I''m getting a black screen - which is an improvement.. I''ll keep trying - thanks for your help.
Lord Karnus - I''m trying to keep it in straight c, so it can be a tute here on NeHe''s.
thanks again
Khrob
_____________________________________________
I used to be indecisive. Now I''m not so sure...
Lord Karnus - I''m trying to keep it in straight c, so it can be a tute here on NeHe''s.
thanks again
Khrob
_____________________________________________
I used to be indecisive. Now I''m not so sure...
_________________________________I used to be indecisive. Now I'm not so sure...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement