Jump to content

  • Log In with Google      Sign In   
  • Create Account

Vorel512

Member Since 02 Jan 2012
Offline Last Active Aug 30 2012 06:42 AM

#4941857 render vbo not working

Posted by Vorel512 on 21 May 2012 - 02:31 AM

Hello,

So...

glBufferData(GL_ARRAY_BUFFER, sizeof(Vertex)*3,&triangle[0].x,GL_STATIC_DRAW);
You should pass a pointer to "&triangle" and with sizeof(triangle) now you allocate memory for only the first position. And then try to set opengl where to search for specified data like normals. It would be a great start to read and try out some example."
#define BUFFER_OFFSET(i) ((char *)NULL + (i))
glEnableVertexAttribArray(GLKVertexAttribPosition);
    glVertexAttribPointer(GLKVertexAttribPosition, 3, GL_FLOAT, GL_FALSE, 24, BUFFER_OFFSET(0));
   
    glEnableVertexAttribArray(GLKVertexAttribNormal);
    glVertexAttribPointer(GLKVertexAttribNormal, 3, GL_FLOAT, GL_FALSE, 24, BUFFER_OFFSET(12));
   
    glEnableVertexAttribArray(GLKVertexAttribTexCoord0);
    glVertexAttribPointer(GLKVertexAttribTexCoord0, 2, GL_FLOAT, GL_FALSE, 24, BUFFER_OFFSET(24));

sizeof() gives you the size of the variable in bytes, not the amount of data stored in them. In your case all vertexes has 8 elements (3+3+2 = 8) and 3 vertexes (3*8=24).


#4899544 Handling sprite (array or vector)

Posted by Vorel512 on 04 January 2012 - 05:00 AM

Use linked lists ( a grovable array).
You can set their size, add elements, remove elements, insert an element somewhere, etc-etc dinamically.


#4899084 Clientside prediction & correction

Posted by Vorel512 on 02 January 2012 - 03:59 PM

Hi,

Sending commands are much more efficient than sending snapshots of position.
The client should be able to calculate and run the command such as "moveto objectid,x,y,speed".
Sending corrections... I do not get it... The coordinate system should be the same everywhere.
A little difference is acceptable.


PARTNERS