static void gl_vbo_draw(void)
{
   if (gfx_plugin != GFX_GLIDE64)
      return;

   vbo_draw();
}
예제 #2
0
FX_ENTRY void FX_CALL
grDrawTriangle(const void *a, const void *b, const void *c)
{
    WriteTrace(TraceGlitch, TraceDebug, "start");

    if (nvidia_viewport_hack && !render_to_texture)
    {
        glViewport(0, viewport_offset, viewport_width, viewport_height);
        nvidia_viewport_hack = 0;
    }

    reloadTexture();

    if (need_to_compile) compile_shader();

    if (vertex_buffer_count + 3 > VERTEX_BUFFER_SIZE)
    {
        vbo_draw();
    }
    vertex_draw_mode = GL_TRIANGLES;
    memcpy(&vertex_buffer[vertex_buffer_count], a, VERTEX_SIZE);
    memcpy(&vertex_buffer[vertex_buffer_count + 1], b, VERTEX_SIZE);
    memcpy(&vertex_buffer[vertex_buffer_count + 2], c, VERTEX_SIZE);
    vertex_buffer_count += 3;

    WriteTrace(TraceGlitch, TraceDebug, "Done");
}
예제 #3
0
//Buffer vertices instead of glDrawArrays(...)
void vbo_buffer(GLenum mode, GLint first, GLsizei count, void* pointers)
{
    if ((count != 3 && mode != GL_TRIANGLES) || vertex_buffer_count + count > VERTEX_BUFFER_SIZE)
    {
        vbo_draw();
    }

    memcpy(&vertex_buffer[vertex_buffer_count], pointers, count * VERTEX_SIZE);
    vertex_buffer_count += count;

    if (count == 3 || mode == GL_TRIANGLES)
    {
        vertex_draw_mode = GL_TRIANGLES;
    }
    else
    {
        vertex_draw_mode = mode;
        vbo_draw(); //Triangle fans and strips can't be joined as easily, just draw them straight away.
    }
}
static void vbo_append(GLenum mode, GLsizei count, void *pointers)
{
   if (vbuf_length + count > VERTEX_BUFFER_SIZE)
     vbo_draw();

   /* keep caching triangles as much as possible. */
   if (count == 3 && vbuf_primitive == GL_TRIANGLES)
      mode = GL_TRIANGLES;

   while (count--)
   {
      memcpy(&vbuf_data[vbuf_length++], pointers, sizeof(VBufVertex));
      pointers = (char*)pointers + sizeof(VERTEX);
   }

   vbuf_primitive = mode;

   /* we can't handle anything but triangles so flush it */
   if (mode != GL_TRIANGLES)
      vbo_draw();
}
예제 #5
0
//Buffer vertices instead of glDrawArrays(...)
static void vbo_buffer(GLenum mode,GLint first,GLsizei count,void* pointers)
{
   if(!vertex_buffer_enabled && previous_pointers != pointers)
   {
      VERTEX *v = (VERTEX*)&vertex_buffer[0];
      // enable vertex buffer if not already enabled

      vertex_buffer_enabled = true;
      glEnableVertexAttribArray(POSITION_ATTR);
      glVertexAttribPointer(POSITION_ATTR, 4, GL_FLOAT, false, VERTEX_SIZE, &v->x); //Position

      glEnableVertexAttribArray(COLOUR_ATTR);
      glVertexAttribPointer(COLOUR_ATTR, 4, GL_UNSIGNED_BYTE, true, VERTEX_SIZE, &v->b); //Colour

      glEnableVertexAttribArray(TEXCOORD_0_ATTR);
      glVertexAttribPointer(TEXCOORD_0_ATTR, 2, GL_FLOAT, false, VERTEX_SIZE, &v->coord[2]); //Tex0

      glEnableVertexAttribArray(TEXCOORD_1_ATTR);
      glVertexAttribPointer(TEXCOORD_1_ATTR, 2, GL_FLOAT, false, VERTEX_SIZE, &v->coord[0]); //Tex1

      glEnableVertexAttribArray(FOG_ATTR);
      glVertexAttribPointer(FOG_ATTR, 1, GL_FLOAT, false, VERTEX_SIZE, &v->f); //Fog
      
      previous_pointers = pointers;
   }

   if((count != 3 && mode != GL_TRIANGLES) || vertex_buffer_count + count > VERTEX_BUFFER_SIZE)
      vbo_draw();

   memcpy(&vertex_buffer[vertex_buffer_count],pointers,count * VERTEX_SIZE);
   vertex_buffer_count += count;

   if(count == 3 || mode == GL_TRIANGLES)
      vertex_draw_mode = GL_TRIANGLES;
   else
   {
      vertex_draw_mode = mode;
      vbo_draw(); //Triangle fans and strips can't be joined as easily, just draw them straight away.
   }
}
int retro_return(bool just_flipping)
{
   if (!stop)
   {
      state_job_done = savestates_job_nothing;
      flip_only = just_flipping;

      vbo_draw();
      co_switch(main_thread);

      return state_job_done;
   }

   return 0;
}
예제 #7
0
FX_ENTRY void FX_CALL
grDrawTriangle( const void *a, const void *b, const void *c )
{
   LOG("grDrawTriangle()\r\n\t");

   if(need_to_compile)
      compile_shader();

   if(vertex_buffer_count + 3 > VERTEX_BUFFER_SIZE)
      vbo_draw();

   vertex_draw_mode = GL_TRIANGLES;
   memcpy(&vertex_buffer[vertex_buffer_count],a,VERTEX_SIZE);
   memcpy(&vertex_buffer[vertex_buffer_count+1],b,VERTEX_SIZE);
   memcpy(&vertex_buffer[vertex_buffer_count+2],c,VERTEX_SIZE);
   vertex_buffer_count += 3;
}
예제 #8
0
void vbo_disable()
{
    vbo_draw();
    vertex_buffer_enabled = false;
}
static void gl_vbo_draw(void)
{
   vbo_draw();
}
void vbo_disable(void)
{
   vbo_draw();
   vbuf_enabled = false;
}