Example #1
0
static void GLAPIENTRY
VertexAttrib1ivARB(GLuint index, const GLint *v)
{
   CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, (GLfloat)v[0]));
}
Example #2
0
static void GLAPIENTRY
VertexAttrib4dvARB(GLuint index, const GLdouble *v)
{
   CALL_VertexAttrib4dv(GET_DISPATCH(), (index, v));
}
Example #3
0
static void GLAPIENTRY
VertexAttribI3ubv(GLuint index, const GLubyte *v)
{
   CALL_VertexAttribI3uiEXT(GET_DISPATCH(), (index, v[0], v[1], v[2]));
}
Example #4
0
static void GLAPIENTRY
vbo_exec_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
{
   GET_CURRENT_CONTEXT(ctx);
   GLfloat u, du, v, dv, v1, u1;
   GLint i, j;

   ASSERT_OUTSIDE_BEGIN_END(ctx);

   switch (mode) {
   case GL_POINT:
   case GL_LINE:
   case GL_FILL:
      break;
   default:
      _mesa_error( ctx, GL_INVALID_ENUM, "glEvalMesh2(mode)" );
      return;
   }

   /* No effect if vertex maps disabled.
    */
   if (!ctx->Eval.Map2Vertex4 && 
       !ctx->Eval.Map2Vertex3 &&
       !(ctx->VertexProgram._Enabled && ctx->Eval.Map2Attrib[VERT_ATTRIB_POS]))
      return;

   du = ctx->Eval.MapGrid2du;
   dv = ctx->Eval.MapGrid2dv;
   v1 = ctx->Eval.MapGrid2v1 + j1 * dv;
   u1 = ctx->Eval.MapGrid2u1 + i1 * du;

   switch (mode) {
   case GL_POINT:
      CALL_Begin(GET_DISPATCH(), (GL_POINTS));
      for (v=v1,j=j1;j<=j2;j++,v+=dv) {
	 for (u=u1,i=i1;i<=i2;i++,u+=du) {
	    CALL_EvalCoord2f(GET_DISPATCH(), (u, v));
	 }
      }
      CALL_End(GET_DISPATCH(), ());
      break;
   case GL_LINE:
      for (v=v1,j=j1;j<=j2;j++,v+=dv) {
	 CALL_Begin(GET_DISPATCH(), (GL_LINE_STRIP));
	 for (u=u1,i=i1;i<=i2;i++,u+=du) {
	    CALL_EvalCoord2f(GET_DISPATCH(), (u, v));
	 }
	 CALL_End(GET_DISPATCH(), ());
      }
      for (u=u1,i=i1;i<=i2;i++,u+=du) {
	 CALL_Begin(GET_DISPATCH(), (GL_LINE_STRIP));
	 for (v=v1,j=j1;j<=j2;j++,v+=dv) {
	    CALL_EvalCoord2f(GET_DISPATCH(), (u, v));
	 }
	 CALL_End(GET_DISPATCH(), ());
      }
      break;
   case GL_FILL:
      for (v=v1,j=j1;j<j2;j++,v+=dv) {
	 CALL_Begin(GET_DISPATCH(), (GL_TRIANGLE_STRIP));
	 for (u=u1,i=i1;i<=i2;i++,u+=du) {
	    CALL_EvalCoord2f(GET_DISPATCH(), (u, v));
	    CALL_EvalCoord2f(GET_DISPATCH(), (u, v+dv));
	 }
	 CALL_End(GET_DISPATCH(), ());
      }
      break;
   }
}
Example #5
0
static void GLAPIENTRY
VertexAttrib4uivARB(GLuint index, const GLuint *v)
{
   CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1],
                                           (GLfloat)v[2], (GLfloat)v[3]));
}
Example #6
0
static void GLAPIENTRY VertexAttrib3uivARB(GLuint index, const GLuint *v)
{
   CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, v[0], v[1], v[2]));
}
Example #7
0
/* it is defined to gl_dispatch_stub_NNN in indirect.h */
void gl_dispatch_stub_GetSeparableFilterEXT (GLenum target, GLenum format,
                                             GLenum type, GLvoid * row,
                                             GLvoid * column, GLvoid * span)
{
   struct glx_context *const gc = __glXGetCurrentContext();

#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
   if (gc->isDirect) {
      const _glapi_proc *const table = (_glapi_proc *) GET_DISPATCH();
      PFNGLGETSEPARABLEFILTEREXTPROC p =
         (PFNGLGETSEPARABLEFILTEREXTPROC) table[359];

      p(target, format, type, row, column, span);
      return;
   }
   else
#endif
   {
      Display *const dpy = gc->currentDpy;
      const GLuint cmdlen = __GLX_PAD(13);

      if (dpy != NULL) {
         const __GLXattribute *const state = gc->client_state_private;
         xGLXGetSeparableFilterReply reply;
         GLubyte const *pc =
            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
                                    X_GLvop_GetSeparableFilterEXT, cmdlen);
         unsigned compsize;


         (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
         (void) memcpy((void *) (pc + 4), (void *) (&format), 4);
         (void) memcpy((void *) (pc + 8), (void *) (&type), 4);
         *(int8_t *) (pc + 12) = state->storePack.swapEndian;

         (void) _XReply(dpy, (xReply *) & reply, 0, False);

         compsize = reply.length << 2;

         if (compsize != 0) {
            const GLint width = reply.width;
            const GLint height = reply.height;
            const GLint widthsize =
               __glImageSize(width, 1, 1, format, type, 0);
            const GLint heightsize =
               __glImageSize(height, 1, 1, format, type, 0);
            GLubyte *const buf =
               malloc((widthsize > heightsize) ? widthsize : heightsize);

            if (buf == NULL) {
               /* Throw data away */
               _XEatData(dpy, compsize);
               __glXSetError(gc, GL_OUT_OF_MEMORY);

               UnlockDisplay(dpy);
               SyncHandle();
               return;
            }
            else {
               int extra;

               extra = 4 - (widthsize & 3);
               _XRead(dpy, (char *) buf, widthsize);
               if (extra < 4) {
                  _XEatData(dpy, extra);
               }

               __glEmptyImage(gc, 1, width, 1, 1, format, type, buf, row);

               extra = 4 - (heightsize & 3);
               _XRead(dpy, (char *) buf, heightsize);
               if (extra < 4) {
                  _XEatData(dpy, extra);
               }

               __glEmptyImage(gc, 1, height, 1, 1, format, type, buf, column);

               free((char *) buf);
            }
         }
      }
   }
}
Example #8
0
static void GLAPIENTRY VertexAttrib3usvNV(GLuint index, const GLushort *v)
{
   CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2]));
}
Example #9
0
static void GLAPIENTRY VertexAttrib3NivNV(GLuint index, const GLint *v)
{
   CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]),
					       INT_TO_FLOAT(v[1]),
					       INT_TO_FLOAT(v[2])));
}
Example #10
0
static void GLAPIENTRY VertexAttrib3NbvNV(GLuint index, const GLbyte *v)
{
   CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]),
					       BYTE_TO_FLOAT(v[1]),
					       BYTE_TO_FLOAT(v[2])));
}
Example #11
0
static void GLAPIENTRY VertexAttrib4ubvNV(GLuint index, const GLubyte *v)
{
   CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3]));
}
Example #12
0
void NAME(_gloffset_GetSeparableFilter)(GLenum target, GLenum format, GLenum type,
					GLvoid *row, GLvoid *column, GLvoid *span)
{
    __GLXcontext * const gc = __glXGetCurrentContext();

    if (gc->isDirect) {
	CALL_GetSeparableFilter(GET_DISPATCH(),
				(target, format, type, row, column, span));
	return;
    }
    else {
        Display *const dpy = gc->currentDpy;
	const GLuint cmdlen = __GLX_PAD(13);

	if (dpy != NULL) {
	    const __GLXattribute * const state = gc->client_state_private;
	    xGLXGetSeparableFilterReply reply;
	    GLubyte const *pc =
	      __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
				      X_GLvop_GetSeparableFilterEXT, cmdlen);
	    unsigned compsize;


	    (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
	    (void) memcpy((void *) (pc + 4), (void *) (&format), 4);
	    (void) memcpy((void *) (pc + 8), (void *) (&type), 4);
	    *(int8_t *) (pc + 12) = state->storePack.swapEndian;

	    (void) _XReply(dpy, (xReply *) & reply, 0, False);

	    compsize = reply.length << 2;

	    if (compsize != 0) {
		const GLint width = reply.width;
		const GLint height = reply.height;
		const GLint widthsize =
		  __glImageSize(width, 1, 1, format, type, 0);
		const GLint heightsize =
		  __glImageSize(height, 1, 1, format, type, 0);
		GLubyte * const buf =
		  (GLubyte*) Xmalloc((widthsize > heightsize) ? widthsize : heightsize);

		if (buf == NULL) {
		    /* Throw data away */
		    _XEatData(dpy, compsize);
		    __glXSetError(gc, GL_OUT_OF_MEMORY);

		    UnlockDisplay(dpy);
		    SyncHandle();
		    return;
		} else {
		    int extra;
		    
		    extra = 4 - (widthsize & 3);
		    _XRead(dpy, (char *)buf, widthsize);
		    if (extra < 4) {
			_XEatData(dpy, extra);
		    }

		    __glEmptyImage(gc, 1, width, 1, 1, format, type, buf,
				   row);

		    extra = 4 - (heightsize & 3);
		    _XRead(dpy, (char *)buf, heightsize);
		    if (extra < 4) {
			_XEatData(dpy, extra);
		    }

		    __glEmptyImage(gc, 1, height, 1, 1, format, type, buf,
				   column);

		    Xfree((char*) buf);
		}
	    }
	}
    }
}
Example #13
0
/* Begin/End
 */
static void radeon_Begin( GLenum mode )
{
   GET_CURRENT_CONTEXT(ctx);
   radeonContextPtr rmesa = RADEON_CONTEXT(ctx);

   if (RADEON_DEBUG & DEBUG_VFMT)
      fprintf(stderr, "%s( %s )\n", __FUNCTION__,
	      _mesa_lookup_enum_by_nr( mode ));

   if (mode > GL_POLYGON) {
      _mesa_error( ctx, GL_INVALID_ENUM, "glBegin" );
      return;
   }

   if (rmesa->vb.prim[0] != GL_POLYGON+1) {
      _mesa_error( ctx, GL_INVALID_OPERATION, "glBegin" );
      return;
   }
   
   if (ctx->NewState) 
      _mesa_update_state( ctx );

   if (rmesa->NewGLState)
      radeonValidateState( ctx );

   if (rmesa->vb.recheck) 
      radeonVtxfmtValidate( ctx );

   if (!rmesa->vb.installed) {
      CALL_Begin(GET_DISPATCH(), (mode));
      return;
   }


   if (rmesa->dma.flush && rmesa->vb.counter < 12) {
      if (RADEON_DEBUG & DEBUG_VFMT)
	 fprintf(stderr, "%s: flush almost-empty buffers\n", __FUNCTION__);
      flush_prims( rmesa );
   }

   /* Need to arrange to save vertices here?  Or always copy from dma (yuk)?
    */
   if (!rmesa->dma.flush) {
/* FIXME: what are these constants? */
      if (rmesa->dma.current.ptr + 12*rmesa->vb.vertex_size*4 > 
	  rmesa->dma.current.end) {
	 RADEON_NEWPRIM( rmesa );
	 radeonRefillCurrentDmaRegion( rmesa );
      }

      rmesa->vb.dmaptr = (int *)(rmesa->dma.current.address + rmesa->dma.current.ptr);
      rmesa->vb.counter = (rmesa->dma.current.end - rmesa->dma.current.ptr) / 
	 (rmesa->vb.vertex_size * 4);
      rmesa->vb.counter--;
      rmesa->vb.initial_counter = rmesa->vb.counter;
      rmesa->vb.notify = wrap_buffer;
      rmesa->dma.flush = flush_prims;
      ctx->Driver.NeedFlush |= FLUSH_STORED_VERTICES;
   }
   
   
   rmesa->vb.prim[0] = mode;
   start_prim( rmesa, mode | PRIM_BEGIN );
}
Example #14
0
static void VFMT_FALLBACK( const char *caller )
{
   GET_CURRENT_CONTEXT(ctx);
   radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
   GLfloat tmp[3][RADEON_MAX_VERTEX_SIZE];
   GLuint i, prim;
   GLuint ind = rmesa->vb.vertex_format;
   GLuint nrverts;
   GLfloat alpha = 1.0;
   GLuint unit;

   if (RADEON_DEBUG & (DEBUG_FALLBACKS|DEBUG_VFMT))
      fprintf(stderr, "%s from %s\n", __FUNCTION__, caller);

   if (rmesa->vb.prim[0] == GL_POLYGON+1) {
      VFMT_FALLBACK_OUTSIDE_BEGIN_END( __FUNCTION__ );
      return;
   }

   /* Copy vertices out of dma:
    */
   nrverts = copy_dma_verts( rmesa, tmp );

   /* Finish the prim at this point:
    */
   note_last_prim( rmesa, 0 );
   flush_prims( rmesa );

   /* Update ctx->Driver.CurrentExecPrimitive and swap in swtnl. 
    */
   prim = rmesa->vb.prim[0];
   ctx->Driver.CurrentExecPrimitive = GL_POLYGON+1;
   _tnl_wakeup_exec( ctx );
   ctx->Driver.FlushVertices = radeonFlushVertices;

   assert(rmesa->dma.flush == 0);
   rmesa->vb.fell_back = GL_TRUE;
   rmesa->vb.installed = GL_FALSE;
   CALL_Begin(GET_DISPATCH(), (prim));
   
   if (rmesa->vb.installed_color_3f_sz == 4)
      alpha = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3];

   /* Replay saved vertices
    */
   for (i = 0 ; i < nrverts; i++) {
      GLuint offset = 3;
      if (ind & RADEON_CP_VC_FRMT_N0) {
	 CALL_Normal3fv(GET_DISPATCH(), (&tmp[i][offset]));
	 offset += 3;
      }

      if (ind & RADEON_CP_VC_FRMT_PKCOLOR) {
	 radeon_color_t *col = (radeon_color_t *)&tmp[i][offset];
	 CALL_Color4ub(GET_DISPATCH(), (col->red, col->green, col->blue, col->alpha));
	 offset++;
      }
      else if (ind & RADEON_CP_VC_FRMT_FPALPHA) {
	 CALL_Color4fv(GET_DISPATCH(), (&tmp[i][offset]));
	 offset+=4;
      } 
      else if (ind & RADEON_CP_VC_FRMT_FPCOLOR) {
	 CALL_Color3fv(GET_DISPATCH(), (&tmp[i][offset]));
	 offset+=3;
      }

      if (ind & RADEON_CP_VC_FRMT_PKSPEC) {
	 radeon_color_t *spec = (radeon_color_t *)&tmp[i][offset];
	 CALL_SecondaryColor3ubEXT(GET_DISPATCH(), (spec->red, spec->green, spec->blue));
	 offset++;
      }

      for (unit = 0 ; unit < ctx->Const.MaxTextureUnits; unit++) {
	 if (ind & RADEON_ST_BIT(unit)) {
	    CALL_MultiTexCoord2fvARB(GET_DISPATCH(), ((GL_TEXTURE0 + unit), &tmp[i][offset]));
	    offset += 2;
	 }
      }
      CALL_Vertex3fv(GET_DISPATCH(), (&tmp[i][0]));
   }

   /* Replay current vertex
    */
   if (ind & RADEON_CP_VC_FRMT_N0) 
      CALL_Normal3fv(GET_DISPATCH(), (rmesa->vb.normalptr));

   if (ind & RADEON_CP_VC_FRMT_PKCOLOR)
      CALL_Color4ub(GET_DISPATCH(), (rmesa->vb.colorptr->red, rmesa->vb.colorptr->green,
      				     rmesa->vb.colorptr->blue, rmesa->vb.colorptr->alpha));
   else if (ind & RADEON_CP_VC_FRMT_FPALPHA)
      CALL_Color4fv(GET_DISPATCH(), (rmesa->vb.floatcolorptr));
   else if (ind & RADEON_CP_VC_FRMT_FPCOLOR) {
      if (rmesa->vb.installed_color_3f_sz == 4 && alpha != 1.0)
	 CALL_Color4f(GET_DISPATCH(), (rmesa->vb.floatcolorptr[0],
				       rmesa->vb.floatcolorptr[1],
				       rmesa->vb.floatcolorptr[2],
				       alpha));
      else
	 CALL_Color3fv(GET_DISPATCH(), (rmesa->vb.floatcolorptr));
   }

   if (ind & RADEON_CP_VC_FRMT_PKSPEC) 
       CALL_SecondaryColor3ubEXT(GET_DISPATCH(), (rmesa->vb.specptr->red,
       						  rmesa->vb.specptr->green,
						  rmesa->vb.specptr->blue));

   for (unit = 0 ; unit < ctx->Const.MaxTextureUnits; unit++) {
      if (ind & RADEON_ST_BIT(unit)) {
	 CALL_MultiTexCoord2fvARB(GET_DISPATCH(), ((GL_TEXTURE0 + unit),
	 			  rmesa->vb.texcoordptr[unit]));
      }
   }
}
Example #15
0
static void GLAPIENTRY VertexAttrib3NusvARB(GLuint index, const GLushort *v)
{
   CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]),
					       USHORT_TO_FLOAT(v[1]),
					       USHORT_TO_FLOAT(v[2])));
}
Example #16
0
static void GLAPIENTRY VertexAttrib1NuivNV(GLuint index, const GLuint *v)
{
   CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0])));
}
Example #17
0
static void GLAPIENTRY VertexAttrib4usvARB(GLuint index, const GLushort *v)
{
   CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3]));
}
Example #18
0
static void GLAPIENTRY VertexAttrib2uivNV(GLuint index, const GLuint *v)
{
   CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1]));
}
Example #19
0
/* Insert the active immediate struct onto the display list currently
 * being built.
 */
static void _save_compile_vertex_list( struct gl_context *ctx )
{
   struct vbo_save_context *save = &vbo_context(ctx)->save;
   struct vbo_save_vertex_list *node;

   /* Allocate space for this structure in the display list currently
    * being compiled.
    */
   node = (struct vbo_save_vertex_list *)
      _mesa_dlist_alloc(ctx, save->opcode_vertex_list, sizeof(*node));

   if (!node)
      return;

   /* Duplicate our template, increment refcounts to the storage structs:
    */
   memcpy(node->attrsz, save->attrsz, sizeof(node->attrsz));
   node->vertex_size = save->vertex_size;
   node->buffer_offset = (save->buffer - save->vertex_store->buffer) * sizeof(GLfloat); 
   node->count = save->vert_count;
   node->wrap_count = save->copied.nr;
   node->dangling_attr_ref = save->dangling_attr_ref;
   node->prim = save->prim;
   node->prim_count = save->prim_count;
   node->vertex_store = save->vertex_store;
   node->prim_store = save->prim_store;

   node->vertex_store->refcount++;
   node->prim_store->refcount++;


   node->current_size = node->vertex_size - node->attrsz[0];
   node->current_data = NULL;

   if (node->current_size) {
      /* If the malloc fails, we just pull the data out of the VBO
       * later instead.
       */
      node->current_data = MALLOC( node->current_size * sizeof(GLfloat) );
      if (node->current_data) {
         const char *buffer = (const char *)save->vertex_store->buffer;
         unsigned attr_offset = node->attrsz[0] * sizeof(GLfloat);
         unsigned vertex_offset = 0;

         if (node->count)
            vertex_offset = (node->count-1) * node->vertex_size * sizeof(GLfloat);

         memcpy( node->current_data,
                 buffer + node->buffer_offset + vertex_offset + attr_offset,
                 node->current_size * sizeof(GLfloat) );
      }
   }



   assert(node->attrsz[VBO_ATTRIB_POS] != 0 ||
	  node->count == 0);

   if (save->dangling_attr_ref)
      ctx->ListState.CurrentList->Flags |= DLIST_DANGLING_REFS;

   save->vertex_store->used += save->vertex_size * node->count;
   save->prim_store->used += node->prim_count;


   /* Copy duplicated vertices 
    */
   save->copied.nr = _save_copy_vertices( ctx, node, save->buffer );


   /* Deal with GL_COMPILE_AND_EXECUTE:
    */
   if (ctx->ExecuteFlag) {
      struct _glapi_table *dispatch = GET_DISPATCH();

      _glapi_set_dispatch(ctx->Exec);

      vbo_loopback_vertex_list( ctx,
				(const GLfloat *)((const char *)save->vertex_store->buffer + 
						  node->buffer_offset),
				node->attrsz,
				node->prim,
				node->prim_count,
				node->wrap_count,
				node->vertex_size);

      _glapi_set_dispatch(dispatch);
   }


   /* Decide whether the storage structs are full, or can be used for
    * the next vertex lists as well.
    */
   if (save->vertex_store->used > 
       VBO_SAVE_BUFFER_SIZE - 16 * (save->vertex_size + 4)) {

      /* Unmap old store:
       */
      unmap_vertex_store( ctx, save->vertex_store );

      /* Release old reference:
       */
      save->vertex_store->refcount--; 
      assert(save->vertex_store->refcount != 0);
      save->vertex_store = NULL;

      /* Allocate and map new store:
       */
      save->vertex_store = alloc_vertex_store( ctx );
      save->buffer_ptr = map_vertex_store( ctx, save->vertex_store );
   } 

   if (save->prim_store->used > VBO_SAVE_PRIM_SIZE - 6) {
      save->prim_store->refcount--; 
      assert(save->prim_store->refcount != 0);
      save->prim_store = alloc_prim_store( ctx );
   } 

   /* Reset our structures for the next run of vertices:
    */
   _save_reset_counters( ctx );
}
Example #20
0
static void GLAPIENTRY VertexAttrib1NbvARB(GLuint index, const GLbyte *v)
{
   CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0])));
}
Example #21
0
void vbo_exec_do_EvalCoord2f( struct vbo_exec_context *exec,
                              GLfloat u, GLfloat v )
{
    GLuint attr;

    for (attr = 1; attr <= VBO_ATTRIB_TEX7; attr++) {
        struct gl_2d_map *map = exec->eval.map2[attr].map;
        if (map) {
            GLfloat uu = (u - map->u1) * map->du;
            GLfloat vv = (v - map->v1) * map->dv;
            GLfloat data[4];

            ASSIGN_4V(data, 0, 0, 0, 1);

            _math_horner_bezier_surf(map->Points,
                                     data,
                                     uu, vv,
                                     exec->eval.map2[attr].sz,
                                     map->Uorder, map->Vorder);

            COPY_SZ_4V( exec->vtx.attrptr[attr],
                        exec->vtx.attrsz[attr],
                        data );
        }
    }

    /** Vertex -- EvalCoord2f is a noop if this map not enabled:
     **/
    if (exec->eval.map2[0].map) {
        struct gl_2d_map *map = exec->eval.map2[0].map;
        GLfloat uu = (u - map->u1) * map->du;
        GLfloat vv = (v - map->v1) * map->dv;
        GLfloat vertex[4];

        ASSIGN_4V(vertex, 0, 0, 0, 1);

        if (exec->ctx->Eval.AutoNormal) {
            GLfloat normal[4];
            GLfloat du[4], dv[4];

            _math_de_casteljau_surf(map->Points, vertex, du, dv, uu, vv,
                                    exec->eval.map2[0].sz,
                                    map->Uorder, map->Vorder);

            if (exec->eval.map2[0].sz == 4) {
                du[0] = du[0]*vertex[3] - du[3]*vertex[0];
                du[1] = du[1]*vertex[3] - du[3]*vertex[1];
                du[2] = du[2]*vertex[3] - du[3]*vertex[2];

                dv[0] = dv[0]*vertex[3] - dv[3]*vertex[0];
                dv[1] = dv[1]*vertex[3] - dv[3]*vertex[1];
                dv[2] = dv[2]*vertex[3] - dv[3]*vertex[2];
            }


            CROSS3(normal, du, dv);
            NORMALIZE_3FV(normal);
            normal[3] = 1.0;

            COPY_SZ_4V( exec->vtx.attrptr[VBO_ATTRIB_NORMAL],
                        exec->vtx.attrsz[VBO_ATTRIB_NORMAL],
                        normal );

        }
        else {
            _math_horner_bezier_surf(map->Points, vertex, uu, vv,
                                     exec->eval.map2[0].sz,
                                     map->Uorder, map->Vorder);
        }

        if (exec->vtx.attrsz[0] == 4)
            CALL_Vertex4fv(GET_DISPATCH(), ( vertex ));
        else
            CALL_Vertex3fv(GET_DISPATCH(), ( vertex ));
    }
}
Example #22
0
static void GLAPIENTRY VertexAttrib2ubvARB(GLuint index, const GLubyte *v)
{
   CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, v[0], v[1]));
}
Example #23
0
static void GLAPIENTRY
VertexAttrib2NuivARB(GLuint index, const GLuint *v)
{
   CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]),
                                           UINT_TO_FLOAT(v[1])));
}
Example #24
0
static void GLAPIENTRY VertexAttrib3NubvARB(GLuint index, const GLubyte *v)
{
   CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]),
					       UBYTE_TO_FLOAT(v[1]),
					       UBYTE_TO_FLOAT(v[2])));
}
Example #25
0
static void GLAPIENTRY
VertexAttrib4fvARB(GLuint index, const GLfloat *v)
{
   CALL_VertexAttrib4fvARB(GET_DISPATCH(), (index, v));
}
Example #26
0
static void GLAPIENTRY VertexAttrib1NsvARB(GLuint index, const GLshort *v)
{
   CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0])));
}
Example #27
0
/**
 * Integer-valued attributes
 */
static void GLAPIENTRY
VertexAttribI1bv(GLuint index, const GLbyte *v)
{
   CALL_VertexAttribI1iEXT(GET_DISPATCH(), (index, v[0]));
}
Example #28
0
static void GLAPIENTRY VertexAttrib1svARB(GLuint index, const GLshort *v)
{
   CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, v[0]));
}
Example #29
0
static void GLAPIENTRY
VertexAttribI4ubv(GLuint index, const GLubyte *v)
{
   CALL_VertexAttribI4ubv(GET_DISPATCH(), (index, v));
}
Example #30
0
static void GLAPIENTRY
VertexAttrib3usvARB(GLuint index, const GLushort *v)
{
   CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, (GLfloat)v[0],
                                           (GLfloat)v[1], (GLfloat)v[2]));
}