inline void VL_glSecondaryColorPointer( GLint size, GLenum type, GLsizei stride, const GLvoid* pointer)
 {
   if(glSecondaryColorPointer)
     glSecondaryColorPointer(size, type, stride, (GLvoid*)pointer);
   else
   if(glSecondaryColorPointerEXT)
     glSecondaryColorPointerEXT(size, type, stride, (GLvoid*)pointer);
   else
     VL_UNSUPPORTED_FUNC();
 }
  inline void VL_glSecondaryColorPointer( GLint size, GLenum type, GLsizei stride, const GLvoid* pointer)
  {
#ifdef GL_VERSION_1_4_DEPRECATED
    if(glSecondaryColorPointer)
      glSecondaryColorPointer(size, type, stride, (GLvoid*)pointer);
    else
#endif      
    if(glSecondaryColorPointerEXT)
      glSecondaryColorPointerEXT(size, type, stride, (GLvoid*)pointer);
    else
      VL_UNSUPPORTED_FUNC();
  }
Exemple #3
0
// Nastavi mesh pro rendering - vertexy
void mesh_vertex_array_set_arb(GAME_MESH_OLD * p_mesh)
{
  VERTEX_ARRAYS *p_va = &p_mesh->varray;
  int m2flag = p_mesh->p_data->m2flag;
  int norm = glstav_pn_triangles
    || m2flag & (MAT2_CALC_MAP1 | MAT2_CALC_MAP2 | MAT2_CALC_MAP3 |
    MAT2_CALC_MAP4);

  glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, p_va->arb_handle_indicie);

  glBindBufferARB(GL_ARRAY_BUFFER_ARB, p_va->ati_handle);
  glVertexPointer(3, GL_FLOAT, 0, BUFFER_OFFSET(p_va->ati_start_pos));

  if (norm) {
    array_normal_on();
    glNormalPointer(GL_FLOAT, 0, BUFFER_OFFSET(p_va->ati_start_norm));
  }
  else {
    array_normal_off();
  }

  if (m2flag & MAT2_DIFFUSE) {
    array_diffuse_on();
    glColorPointer(4, GL_FLOAT, 0, BUFFER_OFFSET(p_va->ati_start_diff));
  }
  else {
    array_diffuse_off();
  }

  if (m2flag & (MAT2_SPECULAR | MAT2_ENV_SPEC)
    || p_mesh->p_data->kflag & KONT_DRAW_SPEC) {
    array_specular_on();
    glSecondaryColorPointerEXT(3, GL_FLOAT, 0,
      BUFFER_OFFSET(p_va->ati_start_spec));
  }
  else {
    array_specular_off();
  }
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_EXTSecondaryColor_nglSecondaryColorPointerEXTBO(JNIEnv *env, jclass clazz, jint size, jint type, jint stride, jlong pPointer_buffer_offset, jlong function_pointer) {
	const GLvoid *pPointer_address = (const GLvoid *)(intptr_t)offsetToPointer(pPointer_buffer_offset);
	glSecondaryColorPointerEXTPROC glSecondaryColorPointerEXT = (glSecondaryColorPointerEXTPROC)((intptr_t)function_pointer);
	glSecondaryColorPointerEXT(size, type, stride, pPointer_address);
}
Exemple #5
0
static void va_render ()
{
   GLint i;

   for (i = 0; i < sizeof (attribs) / sizeof (*attribs); i++) {
      struct ATTRIB_DATA *att = &attribs[i];
      switch (att->dispatch)
      {
      case C:
         glColorPointer (4, GL_FLOAT, 0, att->data);
         glEnable (GL_COLOR_ARRAY);
         break;
      case S:
         glSecondaryColorPointerEXT (4, GL_FLOAT, 0, att->data);
         glEnable (GL_SECONDARY_COLOR_ARRAY_EXT);
         break;
      case N:
         glNormalPointer (GL_FLOAT, 0, att->data);
         glEnable (GL_NORMAL_ARRAY);
         break;
      case V:
         glVertexPointer (4, GL_FLOAT, 0, att->data);
         glEnable (GL_VERTEX_ARRAY);
         break;
      case T:
         assert (att->index >= 0 && att->index < 8);
         glClientActiveTextureARB (GL_TEXTURE0_ARB + att->index);
         glTexCoordPointer (4, GL_FLOAT, 0, att->data);
         glEnable (GL_TEXTURE_COORD_ARRAY);
         break;
      case F:
         glFogCoordPointerEXT (GL_FLOAT, 0, att->data);
         glEnable (GL_FOG_COORDINATE_ARRAY_EXT);
         break;
      case A:
         assert (att->index > 0 && att->index < 16);
         glVertexAttribPointerARB (att->index, 4, GL_FLOAT, GL_FALSE, 0, att->data);
         glEnableVertexAttribArrayARB (att->index);
         break;
      default:
         assert (0);
      }
   }

   glDrawArrays (GL_POINTS, 0, 1);

   for (i = 0; i < sizeof (attribs) / sizeof (*attribs); i++) {
      struct ATTRIB_DATA *att = &attribs[i];
      switch (att->dispatch)
      {
      case C:
         glDisable (GL_COLOR_ARRAY);
         break;
      case S:
         glDisable (GL_SECONDARY_COLOR_ARRAY_EXT);
         break;
      case N:
         glDisable (GL_NORMAL_ARRAY);
         break;
      case V:
         glDisable (GL_VERTEX_ARRAY);
         break;
      case T:
         glClientActiveTextureARB (GL_TEXTURE0_ARB + att->index);
         glDisable (GL_TEXTURE_COORD_ARRAY);
         break;
      case F:
         glDisable (GL_FOG_COORDINATE_ARRAY_EXT);
         break;
      case A:
         glDisableVertexAttribArrayARB (att->index);
         break;
      default:
         assert (0);
      }
   }
}
Exemple #6
0
// Nastavi poly na rendering
void poly_vertex_array_set_arb(EDIT_MESH_POLY * p_poly)
{
  VERTEX_ARRAYS *p_va = &p_poly->varray;
  int spec = p_poly->m2flag & (MAT2_SPECULAR | MAT2_ENV_SPEC)
    || p_poly->kflag & KONT_DRAW_SPEC;
  int norm = glstav_pn_triangles
    || p_poly->m2flag & (MAT2_CALC_MAP1 | MAT2_CALC_MAP2 | MAT2_CALC_MAP3 |
    MAT2_CALC_MAP4);
  int *p_int, ind;

  glBindBufferARB(GL_ARRAY_BUFFER_ARB, p_va->ati_handle);
  glVertexPointer(3, GL_FLOAT, sizeof(p_poly->p_koord[0]), BUFFER_OFFSET(0));

  array_diffuse_on();
  glColorPointer(4, GL_FLOAT, sizeof(p_poly->p_koord[0]),
    BUFFER_OFFSET(16 * sizeof(float)));

  if (norm) {
    array_normal_on();
    glNormalPointer(GL_FLOAT, sizeof(p_poly->p_koord[0]),
      BUFFER_OFFSET(3 * sizeof(float)));
  }
  else {
    array_normal_off();
  }

  if (spec) {
    array_specular_on();
    glSecondaryColorPointerEXT(3, GL_FLOAT, sizeof(p_poly->p_koord[0]),
      BUFFER_OFFSET(24 * sizeof(float)));
  }
  else {
    array_specular_off();
  }

  p_int = glstav_text_map_indicie;

  if (glstav_text_poly_indicie > 0) {
    array_text_set_num(0);
    if ((ind = *p_int) != K_CHYBA) {
      array_text_on();
      glTexCoordPointer(2, GL_FLOAT, sizeof(p_poly->p_koord[0]),
        BUFFER_OFFSET((6 + ((ind) << 1)) * sizeof(float)));
    }
    else {
      array_text_off();
    }
  }
  p_int++;

  if (glstav_text_poly_indicie > 1) {
    array_text_set_num(1);
    if ((ind = *p_int) != K_CHYBA) {
      array_text_on();
      glTexCoordPointer(2, GL_FLOAT, sizeof(p_poly->p_koord[0]),
        BUFFER_OFFSET((6 + ((ind) << 1)) * sizeof(float)));
    }
    else {
      array_text_off();
    }
  }
  p_int++;

  if (glstav_text_poly_indicie > 2) {
    array_text_set_num(2);
    if ((ind = *p_int) != K_CHYBA) {
      array_text_on();
      glTexCoordPointer(2, GL_FLOAT, sizeof(p_poly->p_koord[0]),
        BUFFER_OFFSET((6 + ((ind) << 1)) * sizeof(float)));
    }
    else {
      array_text_off();
    }
  }
  p_int++;


  if (glstav_text_poly_indicie > 3) {
    array_text_set_num(3);
    if ((ind = *p_int) != K_CHYBA) {
      array_text_on();
      glTexCoordPointer(2, GL_FLOAT, sizeof(p_poly->p_koord[0]),
        BUFFER_OFFSET((6 + ((ind) << 1)) * sizeof(float)));
    }
    else {
      array_text_off();
    }
  }

  array_text_set_num(glstav_text_poly_indicie);
  array_text_on();
  glTexCoordPointer(2, GL_FLOAT, sizeof(p_poly->p_koord[0]),
    BUFFER_OFFSET(14 * sizeof(float)));
}