probleme
i create this function called in the display function
vertex is a vector which contain the 512*512 points(xyz) of the matrix [512,512]
normales is a vector which contain the normal for each point -> 512*512 normals
for these 2 vectors, there are (512*512*3) values (one for x, one for y, one for z) (needed to be like this and not in a structure to use glDrawElements(), no?)
indice is a vector which contain the enumeration of all the triangles to draw so there are (3*number_of_triangles) values
and number_of_triangles=511*511*2 (made 2 triangles for each square of consecutive points)
void dessin_3d ()
{
glEnableClientState(GL_VERTEX_ARRAY); // vertex arrays
glEnableClientState(GL_NORMAL_ARRAY);
glVertexPointer(3, GL_DOUBLE, 0, vertex); // filling the arrays
glNormalPointer(GL_DOUBLE, 0, normales);
glLockArraysEXT(0, 786432); //extension_compiled_vertex_array
glDrawElements(GL_TRIANGLES,786432,GL_UNSIGNED_INT,indice); // 786432 bon nombre?
glUnlockArraysEXT; // extension GL_EXT_compiled_vertex_array
glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
}
i include this
#include <windows.h>
#include <GL/glut.h>
#include <stdio.h>
...
but the compilator don''t want glLockArraysEXT() and glUnlockArraysEXT() function.
there is something else to include? another function to un/lock arrays?
and the second problem is that when i leave these 2 function, the program works and the 3d object displayed is good but it''s very very slow to rotate, zoom...
any idea to un/lock and to speed up?
Well firstly CVA''s are only any good for multipass rendering. So you won''t get a speed up with what you''re doing.
In why it isn''t compiling, you have declaired the function haven''t you? And tested for the extension capability, then got the functions address? And all of this worked before you tried to use it?
Death of one is a tragedy, death of a million is just a statistic.
In why it isn''t compiling, you have declaired the function haven''t you? And tested for the extension capability, then got the functions address? And all of this worked before you tried to use it?
Death of one is a tragedy, death of a million is just a statistic.
If at first you don't succeed, redefine success.
i have to declare these 2 function? :
glLockArraysEXT();
glUnlockArraysEXT;
and how test for the extension capability, and then got the functions address?
the program works when i leave these 2 lines :
glLockArraysEXT(0, 786432); //extension_compiled_vertex_array
and
glUnlockArraysEXT; // extension GL_EXT_compiled_vertex_array
what''s the best way to render the 511*511*2 triangles if vertex array are not good for this?
we tell me to use "Terran LOD"(and not systematic triangulation : 2 triangles for each square of consecutif points) method but i have not the time to try another method
glLockArraysEXT();
glUnlockArraysEXT;
and how test for the extension capability, and then got the functions address?
the program works when i leave these 2 lines :
glLockArraysEXT(0, 786432); //extension_compiled_vertex_array
and
glUnlockArraysEXT; // extension GL_EXT_compiled_vertex_array
what''s the best way to render the 511*511*2 triangles if vertex array are not good for this?
we tell me to use "Terran LOD"(and not systematic triangulation : 2 triangles for each square of consecutif points) method but i have not the time to try another method
umm... what do you mean by "but the compilator don''t want", if you mean that the compiler doesn''t know what are glLockArraysEXT and glUnlockArraysEXT, they are implemented as extensions so you have to define those by yourself.
... if you just wanted to know wether your function should work or not... it should here but VA and CVA don''t always result in speedup. there''s also VARS but i never used it (cuz it''s a bit more complicated to initialized).. okee, i hope i understood ur prob. cya.
////in your .h or .hpp file//#ifndef GL_EXT_compiled_vertex_array#define GL_EXT_compiled_vertex_array 1#ifdef GL_GLEXT_PROTOTYPESextern void APIENTRY glLockArraysEXT (GLint, GLsizei);extern void APIENTRY glUnlockArraysEXT (void);#endif /* GL_GLEXT_PROTOTYPES */typedef void (APIENTRY * PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count);typedef void (APIENTRY * PFNGLUNLOCKARRAYSEXTPROC) (void);#endif// EXT_compiled_vertex_arrayextern PFNGLLOCKARRAYSEXTPROC glLockArraysEXT;extern PFNGLUNLOCKARRAYSEXTPROC glUnlockArraysEXT;//// in your .c or .cpp file//PFNGLLOCKARRAYSEXTPROC glLockArraysEXT = NULL;PFNGLUNLOCKARRAYSEXTPROC glUnlockArraysEXT = NULL;//...//and initialize the function pointers in the function where you check/init the OGL extensionsglLockArraysEXT=(PFNGLLOCKARRAYSEXTPROC)wglGetProcAddress("glLockArraysEXT");glUnlockArraysEXT=(PFNGLUNLOCKARRAYSEXTPROC)wglGetProcAddress("glUnlockArraysEXT");
... if you just wanted to know wether your function should work or not... it should here but VA and CVA don''t always result in speedup. there''s also VARS but i never used it (cuz it''s a bit more complicated to initialized).. okee, i hope i understood ur prob. cya.
there''s a tut on Nehe (yep just right here) which check extensions. it''s pretty simple, you should read the red book or any other papers about OGL extensions, then write your own extensions parser/checker/whatever. ok cya.
thanks, the glLockArraysEXT() and glUnlockArraysEXT; function works now.
but it''s still to slow i will try other methods.
but it''s still to slow i will try other methods.
Well you can stop enabling/disabling vertex arrays all the time for a start. Just enable them once in your init function, and disable them in your destruction function.
Death of one is a tragedy, death of a million is just a statistic.
Death of one is a tragedy, death of a million is just a statistic.
If at first you don't succeed, redefine success.
yes good idea
i tried,
i do this one time in the init function
glEnableClientState(GL_VERTEX_ARRAY); // vertex arrays
glEnableClientState(GL_NORMAL_ARRAY);
glVertexPointer(3, GL_DOUBLE, 0, vertex); // filling the arrays
glNormalPointer(GL_DOUBLE, 0, normales);
glLockArraysEXT(0, 786432); //extension_compiled_vertex_array
then i have only this to draw
glDrawElements(GL_TRIANGLES,786432,GL_UNSIGNED_INT,indice);
and i do
glUnlockArraysEXT; // extension GL_EXT_compiled_vertex_array
glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
in the exit function
it works a little faster but not enough
i tried,
i do this one time in the init function
glEnableClientState(GL_VERTEX_ARRAY); // vertex arrays
glEnableClientState(GL_NORMAL_ARRAY);
glVertexPointer(3, GL_DOUBLE, 0, vertex); // filling the arrays
glNormalPointer(GL_DOUBLE, 0, normales);
glLockArraysEXT(0, 786432); //extension_compiled_vertex_array
then i have only this to draw
glDrawElements(GL_TRIANGLES,786432,GL_UNSIGNED_INT,indice);
and i do
glUnlockArraysEXT; // extension GL_EXT_compiled_vertex_array
glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
in the exit function
it works a little faster but not enough
I''m almost sure about this one (and almost sure I could be wrong
).
I think current hardware works internally with GL_FLOAT.
GL_DOUBLE will make it slow converting everything.
But if you''re using CVA''s I guess that vertices should be converted when initialized.
It wouldn''t hurt to try...

I think current hardware works internally with GL_FLOAT.
GL_DOUBLE will make it slow converting everything.
But if you''re using CVA''s I guess that vertices should be converted when initialized.
It wouldn''t hurt to try...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement