Lines Matching refs:obj
54 static void DrawObject( const struct object *obj )
56 if (Have_ARB_vertex_array_object && obj->ArrayObjectID) {
57 glBindVertexArray(obj->ArrayObjectID);
59 if (obj->NumElements > 0) {
61 glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, obj->ElementsBufferID);
62 glDrawRangeElements(GL_LINE_LOOP, 0, obj->MaxElement,
63 obj->NumElements, GL_UNSIGNED_INT, NULL);
68 glDrawArrays(GL_LINE_LOOP, 0, obj->NumVerts);
76 glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->VertexBufferID);
77 glVertexPointer(3, GL_FLOAT, obj->VertexStride, (const void *) (size_t) obj->VertexOffset);
86 /*glVertexPointer(3, GL_FLOAT, 0, (const void *) (size_t) (obj->VertexOffset + 10000));*/
91 glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->ColorBufferID);
92 glColorPointer(3, GL_FLOAT, obj->ColorStride, (const void *) (size_t) obj->ColorOffset);
95 if (obj->NumElements > 0) {
97 glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, obj->ElementsBufferID);
98 glDrawElements(GL_LINE_LOOP, obj->NumElements, GL_UNSIGNED_INT, NULL);
103 glDrawArrays(GL_LINE_LOOP, 0, obj->NumVerts);
221 CreateVertexArrayObject(struct object *obj)
223 glGenVertexArrays(1, &obj->ArrayObjectID);
224 glBindVertexArray(obj->ArrayObjectID);
226 glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->VertexBufferID);
227 glVertexPointer(3, GL_FLOAT, obj->VertexStride, (const void *) (size_t) obj->VertexOffset);
230 glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->ColorBufferID);
231 glColorPointer(3, GL_FLOAT, obj->ColorStride, (const void *) (size_t) obj->ColorOffset);
241 static void MakeObject1(struct object *obj)
251 obj->VertexBufferID = 0;
252 glGenBuffersARB(1, &obj->VertexBufferID);
253 obj->ColorBufferID = obj->VertexBufferID;
254 assert(obj->VertexBufferID != 0);
255 glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->VertexBufferID);
299 obj->NumVerts = 4;
300 obj->VertexOffset = 0;
301 obj->ColorOffset = 3 * sizeof(GLfloat) * obj->NumVerts;
302 obj->VertexStride = 0;
303 obj->ColorStride = 0;
304 obj->NumElements = 0;
305 obj->MaxElement = 0;
316 CreateVertexArrayObject(obj);
324 static void MakeObject2(struct object *obj)
329 glGenBuffersARB(1, &obj->VertexBufferID);
330 obj->ColorBufferID = obj->VertexBufferID;
332 glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->VertexBufferID);
344 obj->NumVerts = 3;
345 obj->VertexOffset = start + 3 * sizeof(GLfloat);
346 obj->ColorOffset = start;
347 obj->VertexStride = 6 * sizeof(GLfloat);
348 obj->ColorStride = 6 * sizeof(GLfloat);
350 obj->NumElements = 0;
351 obj->MaxElement = 0;
356 CreateVertexArrayObject(obj);
364 static void MakeObject3(struct object *obj)
382 obj->NumVerts = 4;
383 obj->VertexOffset = 0;
384 obj->ColorOffset = 3 * sizeof(GLfloat) * obj->NumVerts;
385 obj->VertexStride = 0;
386 obj->ColorStride = 0;
388 bytes = obj->NumVerts * (3 + 3) * sizeof(GLfloat);
391 glGenBuffersARB(1, &obj->VertexBufferID);
392 obj->ColorBufferID = obj->VertexBufferID;
394 glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->VertexBufferID);
398 glGenBuffersARB(1, &obj->ElementsBufferID);
399 glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, obj->ElementsBufferID);
407 obj->NumElements = 4;
408 obj->MaxElement = 3;
411 CreateVertexArrayObject(obj);
419 static void MakeObject4(struct object *obj)
434 obj->VertexOffset = 0;
435 obj->VertexStride = 0;
436 obj->ColorOffset = 0;
437 obj->ColorStride = 0;
438 obj->NumVerts = 4;
440 glGenBuffersARB(1, &obj->VertexBufferID);
441 glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->VertexBufferID);
445 glGenBuffersARB(1, &obj->ColorBufferID);
446 glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->ColorBufferID);
451 obj->ElementsBufferID = 0;
452 obj->NumElements = 0;
453 obj->MaxElement = 0;
456 CreateVertexArrayObject(obj);