Ejemplo n.º 1
0
void
__indirect_glGetCompressedTexImageARB( GLenum target, GLint level, 
				    GLvoid * img )
{
    __GLX_SINGLE_DECLARE_VARIABLES();
    xGLXGetTexImageReply reply;
    size_t image_bytes;

    __GLX_SINGLE_LOAD_VARIABLES();
    __GLX_SINGLE_BEGIN( X_GLsop_GetCompressedTexImage, 8 );
    __GLX_SINGLE_PUT_LONG( 0, target );
    __GLX_SINGLE_PUT_LONG( 4, level );
    __GLX_SINGLE_READ_XREPLY();

    image_bytes = reply.width;
    assert( image_bytes <= ((4 * reply.length) - 0) );
    assert( image_bytes >= ((4 * reply.length) - 3) );
    
    if ( image_bytes != 0 ) {
	_XRead( dpy, (char *) img, image_bytes );
	if ( image_bytes < (4 * reply.length) ) {
	    _XEatData( dpy, (4 * reply.length) - image_bytes );
	}
    }

    __GLX_SINGLE_END();
}
Ejemplo n.º 2
0
void glNewList(GLuint list, GLenum mode)
{
	__GLX_SINGLE_DECLARE_VARIABLES();
	__GLX_SINGLE_LOAD_VARIABLES();
	__GLX_SINGLE_BEGIN(X_GLsop_NewList,8);
	__GLX_SINGLE_PUT_LONG(0,list);
	__GLX_SINGLE_PUT_LONG(4,mode);
	__GLX_SINGLE_END();
}
Ejemplo n.º 3
0
void glDeleteLists(GLuint list, GLsizei range)
{
	__GLX_SINGLE_DECLARE_VARIABLES();
	__GLX_SINGLE_LOAD_VARIABLES();
	__GLX_SINGLE_BEGIN(X_GLsop_DeleteLists,8);
	__GLX_SINGLE_PUT_LONG(0,list);
	__GLX_SINGLE_PUT_LONG(4,range);
	__GLX_SINGLE_END();
}
Ejemplo n.º 4
0
Archivo: singlepix.c Proyecto: aosm/X11
void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type,
		   GLvoid *texels)
{
    __GLX_SINGLE_DECLARE_VARIABLES();
    const __GLXattribute * state;
    xGLXGetTexImageReply reply;
    GLubyte *buf;

    if (!dpy) return;
    __GLX_SINGLE_LOAD_VARIABLES();
    state = gc->client_state_private;

    /* Send request */
    __GLX_SINGLE_BEGIN(X_GLsop_GetTexImage,__GLX_PAD(17));
    __GLX_SINGLE_PUT_LONG(0,target);
    __GLX_SINGLE_PUT_LONG(4,level);
    __GLX_SINGLE_PUT_LONG(8,format);
    __GLX_SINGLE_PUT_LONG(12,type);
    __GLX_SINGLE_PUT_CHAR(16,state->storePack.swapEndian);
    __GLX_SINGLE_READ_XREPLY();
    compsize = reply.length << 2;

    if (compsize != 0) {
	/* Allocate a holding buffer to transform the data from */
	buf = (GLubyte*) Xmalloc(compsize);
	if (!buf) {
	    /* Throw data away */
	    _XEatData(dpy, compsize);
	    __glXSetError(gc, GL_OUT_OF_MEMORY);
	} else {
	    GLint width, height, depth;

	    /*
	    ** Fetch data into holding buffer.  Apply pixel store pack modes
	    ** to put data back into client memory
	    */
	    width = reply.width;
	    height = reply.height;
	    depth = reply.depth;
	    __GLX_SINGLE_GET_CHAR_ARRAY(buf,compsize);
	    __glEmptyImage(gc, 2, width, height, depth, format, type, buf,
			   texels);
	    Xfree((char*) buf);
	}
    } else {
	/*
	** GL error occured, don't modify user's buffer.
	*/
    }
    __GLX_SINGLE_END();
}
Ejemplo n.º 5
0
Archivo: single2.c Proyecto: aosm/X11
void glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer)
{
    __GLX_SINGLE_DECLARE_VARIABLES();

    if (!dpy) return;

    __GLX_SINGLE_LOAD_VARIABLES();
    __GLX_SINGLE_BEGIN(X_GLsop_FeedbackBuffer,8);
    __GLX_SINGLE_PUT_LONG(0,size);
    __GLX_SINGLE_PUT_LONG(4,type);
    __GLX_SINGLE_END();

    gc->feedbackBuf = buffer;
}
Ejemplo n.º 6
0
Archivo: singlepix.c Proyecto: aosm/X11
void glGetHistogram(GLenum target, GLboolean reset, GLenum format,
		    GLenum type, GLvoid *values)
{
    __GLX_SINGLE_DECLARE_VARIABLES();
    const __GLXattribute * state;
    xGLXGetHistogramReply reply;
    GLubyte *buf;

    if (!dpy) return;
    __GLX_SINGLE_LOAD_VARIABLES();
    state = gc->client_state_private;

    /* Send request */
    __GLX_SINGLE_BEGIN(X_GLsop_GetHistogram,__GLX_PAD(14));
    __GLX_SINGLE_PUT_LONG(0,(long)target);
    __GLX_SINGLE_PUT_LONG(4,(long)format);
    __GLX_SINGLE_PUT_LONG(8,(long)type);
    __GLX_SINGLE_PUT_CHAR(12,state->storePack.swapEndian);
    __GLX_SINGLE_PUT_CHAR(13,reset);
    __GLX_SINGLE_READ_XREPLY();
    compsize = (long)reply.length << 2;

    if (compsize != 0) {
        /* Allocate a holding buffer to transform the data from */
        buf = (GLubyte*)Xmalloc(compsize);
        if (!buf) {
            /* Throw data away */
            _XEatData(dpy, compsize);
            __glXSetError(gc, GL_OUT_OF_MEMORY);
        } else {
            GLint width;

            /*
            ** Fetch data into holding buffer.  Apply pixel store pack modes
            ** to put data back into client memory
            */
            width = (int)reply.width;
            __GLX_SINGLE_GET_CHAR_ARRAY(((char*)buf),(long)compsize);
            __glEmptyImage(gc, 1, width, 1, 1, format, type, buf, values);
            Xfree((char*) buf);
        }
    } else {
        /*
        ** GL error occured, don't modify user's buffer.
        */
    }
    __GLX_SINGLE_END();
}
Ejemplo n.º 7
0
void glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params)
{
	__GLX_SINGLE_DECLARE_VARIABLES();
	xGLXSingleReply reply;
	__GLX_SINGLE_LOAD_VARIABLES();
	__GLX_SINGLE_BEGIN(X_GLsop_GetTexGendv,8);
	__GLX_SINGLE_PUT_LONG(0,coord);
	__GLX_SINGLE_PUT_LONG(4,pname);
	__GLX_SINGLE_READ_XREPLY();
	__GLX_SINGLE_GET_SIZE(compsize);
	if (compsize == 1) {
	    __GLX_SINGLE_GET_DOUBLE(params);
	} else {
	    __GLX_SINGLE_GET_DOUBLE_ARRAY(params,compsize);
	}
	__GLX_SINGLE_END();
}
Ejemplo n.º 8
0
void glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params)
{
	__GLX_SINGLE_DECLARE_VARIABLES();
	xGLXSingleReply reply;
	__GLX_SINGLE_LOAD_VARIABLES();
	__GLX_SINGLE_BEGIN(X_GLsop_GetMinmaxParameterfv,8);
	__GLX_SINGLE_PUT_LONG(0,target);
	__GLX_SINGLE_PUT_LONG(4,pname);
	__GLX_SINGLE_READ_XREPLY();
	__GLX_SINGLE_GET_SIZE(compsize);
	if (compsize == 1) {
	    __GLX_SINGLE_GET_FLOAT(params);
	} else {
	    __GLX_SINGLE_GET_FLOAT_ARRAY(params,compsize);
	}
	__GLX_SINGLE_END();
}
Ejemplo n.º 9
0
void glGetMapiv(GLenum target, GLenum query, GLint *v)
{
	__GLX_SINGLE_DECLARE_VARIABLES();
	xGLXSingleReply reply;
	__GLX_SINGLE_LOAD_VARIABLES();
	__GLX_SINGLE_BEGIN(X_GLsop_GetMapiv,8);
	__GLX_SINGLE_PUT_LONG(0,target);
	__GLX_SINGLE_PUT_LONG(4,query);
	__GLX_SINGLE_READ_XREPLY();
	__GLX_SINGLE_GET_SIZE(compsize);
	if (compsize == 1) {
	    __GLX_SINGLE_GET_LONG(v);
	} else {
	    __GLX_SINGLE_GET_LONG_ARRAY(v,compsize);
	}
	__GLX_SINGLE_END();
}
Ejemplo n.º 10
0
void glGetLightiv(GLenum light, GLenum pname, GLint *params)
{
	__GLX_SINGLE_DECLARE_VARIABLES();
	xGLXSingleReply reply;
	__GLX_SINGLE_LOAD_VARIABLES();
	__GLX_SINGLE_BEGIN(X_GLsop_GetLightiv,8);
	__GLX_SINGLE_PUT_LONG(0,light);
	__GLX_SINGLE_PUT_LONG(4,pname);
	__GLX_SINGLE_READ_XREPLY();
	__GLX_SINGLE_GET_SIZE(compsize);
	if (compsize == 1) {
	    __GLX_SINGLE_GET_LONG(params);
	} else {
	    __GLX_SINGLE_GET_LONG_ARRAY(params,compsize);
	}
	__GLX_SINGLE_END();
}
Ejemplo n.º 11
0
void glGetConvolutionFilter(GLenum target, GLenum format, GLenum type,
			    GLvoid *image)
{
    __GLX_SINGLE_DECLARE_VARIABLES();
    xGLXGetConvolutionFilterReply reply;
    GLubyte *buf;

    if (!dpy) return;
    __GLX_SINGLE_LOAD_VARIABLES();

    /* Send request */
    __GLX_SINGLE_BEGIN(X_GLsop_GetConvolutionFilter, __GLX_PAD(13));
    __GLX_SINGLE_PUT_LONG(0,target);
    __GLX_SINGLE_PUT_LONG(4,format);
    __GLX_SINGLE_PUT_LONG(8,type);
    __GLX_SINGLE_PUT_CHAR(12,gc->state.storePack.swapEndian);
    __GLX_SINGLE_READ_XREPLY();
    compsize = reply.length << 2;

    if (compsize != 0) {
	/* Allocate a holding buffer to transform the data from */
	buf = (GLubyte*) Xmalloc(compsize);
	if (!buf) {
	    /* Throw data away */
	    _XEatData(dpy, compsize);
	    __glXSetError(gc, GL_OUT_OF_MEMORY);
	} else {
	    GLint width, height;

	    /*
	    ** Fetch data into holding buffer.  Apply pixel store pack modes
	    ** to put data back into client memory
	    */
	    width = reply.width;
	    height = reply.height;
	    __GLX_SINGLE_GET_CHAR_ARRAY(((char*)buf),compsize);
	    __glEmptyImage(gc, 2, width, height, 1, format, type, buf, image);
	    Xfree((char*) buf);
	}
    } else {
	/*
	** GL error occured, don't modify user's buffer.
	*/
    }
    __GLX_SINGLE_END();
}
Ejemplo n.º 12
0
void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
{
	__GLX_SINGLE_DECLARE_VARIABLES();
	xGLXSingleReply reply;
	__GLX_SINGLE_LOAD_VARIABLES();
	__GLX_SINGLE_BEGIN(X_GLsop_GetTexLevelParameteriv,12);
	__GLX_SINGLE_PUT_LONG(0,target);
	__GLX_SINGLE_PUT_LONG(4,level);
	__GLX_SINGLE_PUT_LONG(8,pname);
	__GLX_SINGLE_READ_XREPLY();
	__GLX_SINGLE_GET_SIZE(compsize);
	if (compsize == 1) {
	    __GLX_SINGLE_GET_LONG(params);
	} else {
	    __GLX_SINGLE_GET_LONG_ARRAY(params,compsize);
	}
	__GLX_SINGLE_END();
}
Ejemplo n.º 13
0
Archivo: single2.c Proyecto: aosm/X11
void glSelectBuffer(GLsizei numnames, GLuint *buffer)
{
    __GLX_SINGLE_DECLARE_VARIABLES();

    if (!dpy) return;

    __GLX_SINGLE_LOAD_VARIABLES();
    __GLX_SINGLE_BEGIN(X_GLsop_SelectBuffer,4);
    __GLX_SINGLE_PUT_LONG(0,numnames);
    __GLX_SINGLE_END();

    gc->selectBuf = buffer;
}
Ejemplo n.º 14
0
Archivo: single2.c Proyecto: aosm/X11
void glGetClipPlane(GLenum plane, GLdouble *equation)
{
    __GLX_SINGLE_DECLARE_VARIABLES();
    xGLXSingleReply reply;
    __GLX_SINGLE_LOAD_VARIABLES();
    __GLX_SINGLE_BEGIN(X_GLsop_GetClipPlane,4);
    __GLX_SINGLE_PUT_LONG(0,plane);
    __GLX_SINGLE_READ_XREPLY();
    if (reply.length == 8) {
	__GLX_SINGLE_GET_DOUBLE_ARRAY(equation,4);
    }
    __GLX_SINGLE_END();
}
Ejemplo n.º 15
0
GLboolean glIsList(GLuint list)
{
	__GLX_SINGLE_DECLARE_VARIABLES();
	GLboolean    retval = 0;
	xGLXSingleReply reply;
	__GLX_SINGLE_LOAD_VARIABLES();
	__GLX_SINGLE_BEGIN(X_GLsop_IsList,4);
	__GLX_SINGLE_PUT_LONG(0,list);
	__GLX_SINGLE_READ_XREPLY();
	__GLX_SINGLE_GET_RETVAL(retval, GLboolean);
	__GLX_SINGLE_END();
	return retval;
}
Ejemplo n.º 16
0
GLuint glGenLists(GLsizei range)
{
	__GLX_SINGLE_DECLARE_VARIABLES();
	GLuint    retval = 0;
	xGLXSingleReply reply;
	__GLX_SINGLE_LOAD_VARIABLES();
	__GLX_SINGLE_BEGIN(X_GLsop_GenLists,4);
	__GLX_SINGLE_PUT_LONG(0,range);
	__GLX_SINGLE_READ_XREPLY();
	__GLX_SINGLE_GET_RETVAL(retval, GLuint);
	__GLX_SINGLE_END();
	return retval;
}
Ejemplo n.º 17
0
void
__indirect_glGetIntegerv(GLenum val, GLint * i)
{
   const GLenum origVal = val;
   __GLX_SINGLE_DECLARE_VARIABLES();
   xGLXSingleReply reply;

   val = RemapTransposeEnum(val);

   __GLX_SINGLE_LOAD_VARIABLES();
   __GLX_SINGLE_BEGIN(X_GLsop_GetIntegerv, 4);
   __GLX_SINGLE_PUT_LONG(0, val);
   __GLX_SINGLE_READ_XREPLY();
   __GLX_SINGLE_GET_SIZE(compsize);

   if (compsize == 0) {
      /*
       ** Error occured; don't modify user's buffer.
       */
   }
   else {
      GLintptr data;

      /*
       ** We still needed to send the request to the server in order to
       ** find out whether it was legal to make a query (it's illegal,
       ** for example, to call a query between glBegin() and glEnd()).
       */

      if (get_client_data(gc, val, &data)) {
         *i = (GLint) data;
      }
      else {
         /*
          ** Not a local value, so use what we got from the server.
          */
         if (compsize == 1) {
            __GLX_SINGLE_GET_LONG(i);
         }
         else {
            __GLX_SINGLE_GET_LONG_ARRAY(i, compsize);
            if (val != origVal) {
               /* matrix transpose */
               TransposeMatrixi(i);
            }
         }
      }
   }
   __GLX_SINGLE_END();
}
Ejemplo n.º 18
0
void glGenTextures(GLsizei n, GLuint *textures)
{
#if 0 /* see comments above */
	__GLX_SINGLE_DECLARE_VARIABLES();
	xGLXSingleReply reply;
	__GLX_SINGLE_LOAD_VARIABLES();
	__GLX_SINGLE_BEGIN(X_GLsop_GenTextures,4);
	__GLX_SINGLE_PUT_LONG(0,n);
	__GLX_SINGLE_READ_XREPLY();
	__GLX_SINGLE_GET_LONG_ARRAY(textures,n);
	__GLX_SINGLE_END();
#else
        glGenTexturesEXT(n, textures);
#endif
}
Ejemplo n.º 19
0
void glDeleteTextures(GLsizei n, const GLuint *textures)
{
#if 0 /* see comments above */
	__GLX_SINGLE_DECLARE_VARIABLES();
	__GLX_SINGLE_LOAD_VARIABLES();
	if (n < 0) return;
	cmdlen = 4+n*4;
	__GLX_SINGLE_BEGIN(X_GLsop_DeleteTextures,cmdlen);
	__GLX_SINGLE_PUT_LONG(0,n);
	__GLX_PUT_LONG_ARRAY(4,textures,n);
	__GLX_SINGLE_END();
#else
        glDeleteTexturesEXT(n, textures);
#endif
}
Ejemplo n.º 20
0
void glGetPixelMapusv(GLenum map, GLushort *values)
{
	__GLX_SINGLE_DECLARE_VARIABLES();
	xGLXSingleReply reply;
	__GLX_SINGLE_LOAD_VARIABLES();
	__GLX_SINGLE_BEGIN(X_GLsop_GetPixelMapusv,4);
	__GLX_SINGLE_PUT_LONG(0,map);
	__GLX_SINGLE_READ_XREPLY();
	__GLX_SINGLE_GET_SIZE(compsize);
	if (compsize == 1) {
	    __GLX_SINGLE_GET_SHORT(values);
	} else {
	    __GLX_SINGLE_GET_SHORT_ARRAY(values,compsize);
	}
	__GLX_SINGLE_END();
}
Ejemplo n.º 21
0
GLboolean glIsTexture(GLuint texture)
{
#if 0 /* see comments above */
	__GLX_SINGLE_DECLARE_VARIABLES();
	GLboolean    retval = 0;
	xGLXSingleReply reply;
	__GLX_SINGLE_LOAD_VARIABLES();
	__GLX_SINGLE_BEGIN(X_GLsop_IsTexture,4);
	__GLX_SINGLE_PUT_LONG(0,texture);
	__GLX_SINGLE_READ_XREPLY();
	__GLX_SINGLE_GET_RETVAL(retval, GLboolean);
	__GLX_SINGLE_END();
	return retval;
#else
        return glIsTextureEXT(texture);
#endif
}
Ejemplo n.º 22
0
Archivo: singlepix.c Proyecto: aosm/X11
void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height,
		  GLenum format, GLenum type, GLvoid *pixels)
{
    __GLX_SINGLE_DECLARE_VARIABLES();
    const __GLXattribute * state;
    xGLXReadPixelsReply reply;
    GLubyte *buf;

    if (!dpy) return;
    __GLX_SINGLE_LOAD_VARIABLES();
    state = gc->client_state_private;

    /* Send request */
    __GLX_SINGLE_BEGIN(X_GLsop_ReadPixels,__GLX_PAD(26));
    __GLX_SINGLE_PUT_LONG(0,x);
    __GLX_SINGLE_PUT_LONG(4,y);
    __GLX_SINGLE_PUT_LONG(8,width);
    __GLX_SINGLE_PUT_LONG(12,height);
    __GLX_SINGLE_PUT_LONG(16,format);
    __GLX_SINGLE_PUT_LONG(20,type);
    __GLX_SINGLE_PUT_CHAR(24,state->storePack.swapEndian);
    __GLX_SINGLE_PUT_CHAR(25,GL_FALSE);
    __GLX_SINGLE_READ_XREPLY();
    compsize = reply.length << 2;

    if (compsize != 0) {
	/* Allocate a holding buffer to transform the data from */
	buf = (GLubyte*) Xmalloc(compsize);
	if (!buf) {
	    /* Throw data away */
	    _XEatData(dpy, compsize);
	    __glXSetError(gc, GL_OUT_OF_MEMORY);
	} else {
	    /*
	    ** Fetch data into holding buffer.  Apply pixel store pack modes
	    ** to put data back into client memory
	    */
	    __GLX_SINGLE_GET_CHAR_ARRAY(buf,compsize);
	    __glEmptyImage(gc, 2, width, height, 1, format, type, buf, pixels);
	    Xfree((char*) buf);
	}
    } else {
	/*
	** GL error occurred; don't modify user's buffer.
	*/
    }
    __GLX_SINGLE_END();
}
Ejemplo n.º 23
0
GLboolean glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences)
{
#if 0 /* see comments above */
	__GLX_SINGLE_DECLARE_VARIABLES();
	GLboolean    retval = 0;
	xGLXSingleReply reply;
	__GLX_SINGLE_LOAD_VARIABLES();
	if (n < 0) return retval;
	cmdlen = 4+n*4;
	__GLX_SINGLE_BEGIN(X_GLsop_AreTexturesResident,cmdlen);
	__GLX_SINGLE_PUT_LONG(0,n);
	__GLX_PUT_LONG_ARRAY(4,textures,n);
	__GLX_SINGLE_READ_XREPLY();
	__GLX_SINGLE_GET_RETVAL(retval, GLboolean);
	__GLX_SINGLE_GET_CHAR_ARRAY(residences,n);
	__GLX_SINGLE_END();
	return retval;
#else
        return glAreTexturesResidentEXT(n, textures, residences);
#endif
}
Ejemplo n.º 24
0
GLboolean
__indirect_glIsEnabled(GLenum cap)
{
   __GLX_SINGLE_DECLARE_VARIABLES();
   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
   xGLXSingleReply reply;
   GLboolean retval = 0;
   GLintptr enable;

   if (!dpy)
      return 0;

   switch (cap) {
   case GL_VERTEX_ARRAY:
   case GL_NORMAL_ARRAY:
   case GL_COLOR_ARRAY:
   case GL_INDEX_ARRAY:
   case GL_EDGE_FLAG_ARRAY:
   case GL_SECONDARY_COLOR_ARRAY:
   case GL_FOG_COORD_ARRAY:
      retval = __glXGetArrayEnable(state, cap, 0, &enable);
      assert(retval);
      return (GLboolean) enable;
      break;
   case GL_TEXTURE_COORD_ARRAY:
      retval = __glXGetArrayEnable(state, GL_TEXTURE_COORD_ARRAY,
                                   __glXGetActiveTextureUnit(state), &enable);
      assert(retval);
      return (GLboolean) enable;
      break;
   }

   __GLX_SINGLE_LOAD_VARIABLES();
   __GLX_SINGLE_BEGIN(X_GLsop_IsEnabled, 4);
   __GLX_SINGLE_PUT_LONG(0, cap);
   __GLX_SINGLE_READ_XREPLY();
   __GLX_SINGLE_GET_RETVAL(retval, GLboolean);
   __GLX_SINGLE_END();
   return retval;
}
Ejemplo n.º 25
0
GLint
__indirect_glRenderMode(GLenum mode)
{
   __GLX_SINGLE_DECLARE_VARIABLES();
   GLint retval = 0;
   xGLXRenderModeReply reply;

   if (!dpy)
      return -1;

   __GLX_SINGLE_LOAD_VARIABLES();
   __GLX_SINGLE_BEGIN(X_GLsop_RenderMode, 4);
   __GLX_SINGLE_PUT_LONG(0, mode);
   __GLX_SINGLE_READ_XREPLY();
   __GLX_SINGLE_GET_RETVAL(retval, GLint);

   if (reply.newMode != mode) {
      /*
       ** Switch to new mode did not take effect, therefore an error
       ** occured.  When an error happens the server won't send us any
       ** other data.
       */
   }
   else {
      /* Read the feedback or selection data */
      if (gc->renderMode == GL_FEEDBACK) {
         __GLX_SINGLE_GET_SIZE(compsize);
         __GLX_SINGLE_GET_FLOAT_ARRAY(gc->feedbackBuf, compsize);
      }
      else if (gc->renderMode == GL_SELECT) {
         __GLX_SINGLE_GET_SIZE(compsize);
         __GLX_SINGLE_GET_LONG_ARRAY(gc->selectBuf, compsize);
      }
      gc->renderMode = mode;
   }
   __GLX_SINGLE_END();

   return retval;
}
Ejemplo n.º 26
0
Archivo: single2.c Proyecto: aosm/X11
GLboolean glIsEnabled(GLenum cap)
{
    __GLX_SINGLE_DECLARE_VARIABLES();
    __GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
    xGLXSingleReply reply;
    GLboolean retval = 0;

    if (!dpy) return 0;

    switch(cap) {
      case GL_VERTEX_ARRAY:
	  return state->vertArray.vertex.enable;
      case GL_NORMAL_ARRAY:
	  return state->vertArray.normal.enable;
      case GL_COLOR_ARRAY:
	  return state->vertArray.color.enable;
      case GL_INDEX_ARRAY:
	  return state->vertArray.index.enable;
      case GL_TEXTURE_COORD_ARRAY:
	  return state->vertArray.texCoord[state->vertArray.activeTexture].enable;
      case GL_EDGE_FLAG_ARRAY:
	  return state->vertArray.edgeFlag.enable;
      case GL_SECONDARY_COLOR_ARRAY:
	  return state->vertArray.secondaryColor.enable;
      case GL_FOG_COORDINATE_ARRAY:
	  return state->vertArray.fogCoord.enable;
    }

    __GLX_SINGLE_LOAD_VARIABLES();
    __GLX_SINGLE_BEGIN(X_GLsop_IsEnabled,4);
    __GLX_SINGLE_PUT_LONG(0,cap);
    __GLX_SINGLE_READ_XREPLY();
    __GLX_SINGLE_GET_RETVAL(retval, GLboolean);
    __GLX_SINGLE_END();
    return retval;
}
Ejemplo n.º 27
0
void glGetSeparableFilter(GLenum target, GLenum format, GLenum type,
			  GLvoid *row, GLvoid *column, GLvoid *span)
{
    __GLX_SINGLE_DECLARE_VARIABLES();
    xGLXGetSeparableFilterReply reply;
    GLubyte *rowBuf, *colBuf;

    if (!dpy) return;
    __GLX_SINGLE_LOAD_VARIABLES();

    /* Send request */
    __GLX_SINGLE_BEGIN(X_GLsop_GetSeparableFilter, __GLX_PAD(13));
    __GLX_SINGLE_PUT_LONG(0,target);
    __GLX_SINGLE_PUT_LONG(4,format);
    __GLX_SINGLE_PUT_LONG(8,type);
    __GLX_SINGLE_PUT_CHAR(12,gc->state.storePack.swapEndian);
    __GLX_SINGLE_READ_XREPLY();
    compsize = reply.length << 2;

    if (compsize != 0) {
	GLint width, height;
	GLint widthsize, heightsize;

	width = reply.width;
	height = reply.height;

	widthsize = __glImageSize(width,1,1,format, type);
	heightsize = __glImageSize(height,1,1,format, type);

	/* Allocate a holding buffer to transform the data from */
	rowBuf = (GLubyte*) Xmalloc(widthsize);
	if (!rowBuf) {
	    /* Throw data away */
	    _XEatData(dpy, compsize);
	    __glXSetError(gc, GL_OUT_OF_MEMORY);
	    UnlockDisplay(dpy);
	    SyncHandle();
	    return;
	} else {
	    __GLX_SINGLE_GET_CHAR_ARRAY(((char*)rowBuf),widthsize);
	    __glEmptyImage(gc, 1, width, 1, 1, format, type, rowBuf, row);
	    Xfree((char*) rowBuf);
	}
	colBuf = (GLubyte*) Xmalloc(heightsize);
	if (!colBuf) {
	    /* Throw data away */
	    _XEatData(dpy, compsize - __GLX_PAD(widthsize));
	    __glXSetError(gc, GL_OUT_OF_MEMORY);
	    UnlockDisplay(dpy);
	    SyncHandle();
	    return;
	} else {
	    __GLX_SINGLE_GET_CHAR_ARRAY(((char*)colBuf),heightsize);
	    __glEmptyImage(gc, 1, height, 1, 1, format, type, colBuf, column);
	    Xfree((char*) colBuf);
	}
    } else {
	/*
	** don't modify user's buffer.
	*/
    }
    __GLX_SINGLE_END();
    
}
Ejemplo n.º 28
0
Archivo: single2.c Proyecto: aosm/X11
void glGetIntegerv(GLenum val, GLint *i)
{
    const GLenum origVal = val;
    __GLX_SINGLE_DECLARE_VARIABLES();
    __GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
    xGLXSingleReply reply;

    if (val == GL_TRANSPOSE_MODELVIEW_MATRIX_ARB) {
       val = GL_MODELVIEW_MATRIX;
    }
    else if (val == GL_TRANSPOSE_PROJECTION_MATRIX_ARB) {
       val = GL_PROJECTION_MATRIX;
    }
    else if (val == GL_TRANSPOSE_TEXTURE_MATRIX_ARB) {
       val = GL_TEXTURE_MATRIX;
    }
    else if (val == GL_TRANSPOSE_COLOR_MATRIX_ARB) {
       val = GL_COLOR_MATRIX;
    }

    __GLX_SINGLE_LOAD_VARIABLES();
    __GLX_SINGLE_BEGIN(X_GLsop_GetIntegerv,4);
    __GLX_SINGLE_PUT_LONG(0,val);
    __GLX_SINGLE_READ_XREPLY();
    __GLX_SINGLE_GET_SIZE(compsize);

    if (compsize == 0) {
	/*
	** Error occured; don't modify user's buffer.
	*/
    } else {
	/*
	** For all the queries listed here, we use the locally stored
	** values rather than the one returned by the server.  Note that
	** we still needed to send the request to the server in order to
	** find out whether it was legal to make a query (it's illegal,
	** for example, to call a query between glBegin() and glEnd()).
	*/
	switch (val) {
	  case GL_PACK_ROW_LENGTH:
	    *i = (GLint)state->storePack.rowLength;
	    break;
	  case GL_PACK_IMAGE_HEIGHT:
	    *i = (GLint)state->storePack.imageHeight;
	    break;
	  case GL_PACK_SKIP_ROWS:
	    *i = (GLint)state->storePack.skipRows;
	    break;
	  case GL_PACK_SKIP_PIXELS:
	    *i = (GLint)state->storePack.skipPixels;
	    break;
	  case GL_PACK_SKIP_IMAGES:
	    *i = (GLint)state->storePack.skipImages;
	    break;
	  case GL_PACK_ALIGNMENT:
	    *i = (GLint)state->storePack.alignment;
	    break;
	  case GL_PACK_SWAP_BYTES:
	    *i = (GLint)state->storePack.swapEndian;
	    break;
	  case GL_PACK_LSB_FIRST:
	    *i = (GLint)state->storePack.lsbFirst;
	    break;
	  case GL_UNPACK_ROW_LENGTH:
	    *i = (GLint)state->storeUnpack.rowLength;
	    break;
	  case GL_UNPACK_IMAGE_HEIGHT:
	    *i = (GLint)state->storeUnpack.imageHeight;
	    break;
	  case GL_UNPACK_SKIP_ROWS:
	    *i = (GLint)state->storeUnpack.skipRows;
	    break;
	  case GL_UNPACK_SKIP_PIXELS:
	    *i = (GLint)state->storeUnpack.skipPixels;
	    break;
	  case GL_UNPACK_SKIP_IMAGES:
	    *i = (GLint)state->storeUnpack.skipImages;
	    break;
	  case GL_UNPACK_ALIGNMENT:
	    *i = (GLint)state->storeUnpack.alignment;
	    break;
	  case GL_UNPACK_SWAP_BYTES:
	    *i = (GLint)state->storeUnpack.swapEndian;
	    break;
	  case GL_UNPACK_LSB_FIRST:
	    *i = (GLint)state->storeUnpack.lsbFirst;
	    break;
	  case GL_VERTEX_ARRAY:
	    *i = (GLint)state->vertArray.vertex.enable;
	    break;
	  case GL_VERTEX_ARRAY_SIZE:
	    *i = (GLint)state->vertArray.vertex.size;
	    break;
	  case GL_VERTEX_ARRAY_TYPE:
	    *i = (GLint)state->vertArray.vertex.type;
	    break;
	  case GL_VERTEX_ARRAY_STRIDE:
	    *i = (GLint)state->vertArray.vertex.stride;
	    break;
	  case GL_NORMAL_ARRAY:
	    *i = (GLint)state->vertArray.normal.enable;
	    break;
	  case GL_NORMAL_ARRAY_TYPE:
	    *i = (GLint)state->vertArray.normal.type;
	    break;
	  case GL_NORMAL_ARRAY_STRIDE:
	    *i = (GLint)state->vertArray.normal.stride;
	    break;
	  case GL_COLOR_ARRAY:
	    *i = (GLint)state->vertArray.color.enable;
	    break;
	  case GL_COLOR_ARRAY_SIZE:
	    *i = (GLint)state->vertArray.color.size;
	    break;
	  case GL_COLOR_ARRAY_TYPE:
	    *i = (GLint)state->vertArray.color.type;
	    break;
	  case GL_COLOR_ARRAY_STRIDE:
	    *i = (GLint)state->vertArray.color.stride;
	    break;
	  case GL_INDEX_ARRAY:
	    *i = (GLint)state->vertArray.index.enable;
	    break;
	  case GL_INDEX_ARRAY_TYPE:
	    *i = (GLint)state->vertArray.index.type;
	    break;
	  case GL_INDEX_ARRAY_STRIDE:
	    *i = (GLint)state->vertArray.index.stride;
	    break;
	  case GL_TEXTURE_COORD_ARRAY:
	    *i = (GLint)state->vertArray.texCoord[state->vertArray.activeTexture].enable;
	    break;
	  case GL_TEXTURE_COORD_ARRAY_SIZE:
	    *i = (GLint)state->vertArray.texCoord[state->vertArray.activeTexture].size;
	    break;
	  case GL_TEXTURE_COORD_ARRAY_TYPE:
	    *i = (GLint)state->vertArray.texCoord[state->vertArray.activeTexture].type;
	    break;
	  case GL_TEXTURE_COORD_ARRAY_STRIDE:
	    *i = (GLint)state->vertArray.texCoord[state->vertArray.activeTexture].stride;
	    break;
	  case GL_EDGE_FLAG_ARRAY:
	    *i = (GLint)state->vertArray.edgeFlag.enable;
	    break;
	  case GL_EDGE_FLAG_ARRAY_STRIDE:
	    *i = (GLint)state->vertArray.edgeFlag.stride;
	    break;

	  CASE_ARRAY_ALL(SECONDARY_COLOR, secondaryColor, i, GLint);

	  CASE_ARRAY_ENABLE(FOG_COORDINATE, fogCoord, i, GLint);
	  CASE_ARRAY_TYPE(FOG_COORDINATE, fogCoord, i, GLint);
	  CASE_ARRAY_STRIDE(FOG_COORDINATE, fogCoord, i, GLint);

	  case GL_MAX_ELEMENTS_VERTICES:
	    *i = (GLint)state->vertArray.maxElementsVertices;
	    break;
	  case GL_MAX_ELEMENTS_INDICES:
	    *i = (GLint)state->vertArray.maxElementsIndices;
	    break;
	  case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:
	    *i = (GLint)__GL_CLIENT_ATTRIB_STACK_DEPTH;
	    break;
	  case GL_CLIENT_ACTIVE_TEXTURE_ARB:
	    *i = (GLint)(state->vertArray.activeTexture + GL_TEXTURE0_ARB);
	    break;
	  default:
	    /*
	    ** Not a local value, so use what we got from the server.
	    */
	    if (compsize == 1) {
		__GLX_SINGLE_GET_LONG(i);
	    } else {
		__GLX_SINGLE_GET_LONG_ARRAY(i,compsize);
                if (val != origVal) {
                   /* matrix transpose */
                   TransposeMatrixi(i);
                }
	    }
	}
    }
    __GLX_SINGLE_END();
}
Ejemplo n.º 29
0
Archivo: single2.c Proyecto: aosm/X11
const GLubyte *glGetString(GLenum name)
{
    __GLX_SINGLE_DECLARE_VARIABLES();
    xGLXSingleReply reply;
    GLubyte *s = NULL;

    if (!dpy) return 0;

    /*
    ** Return the cached copy if the string has already been fetched
    */
    switch(name) {
      case GL_VENDOR:
	if (gc->vendor) return gc->vendor;
	break;
      case GL_RENDERER:
	if (gc->renderer) return gc->renderer;
	break;
      case GL_VERSION:
	if (gc->version) return gc->version;
	break;
      case GL_EXTENSIONS:
	if (gc->extensions) return gc->extensions;
	break;
      default:
	__glXSetError(gc, GL_INVALID_ENUM);
	return 0;
    }

    /*
    ** Get requested string from server
    */
    __GLX_SINGLE_LOAD_VARIABLES();
    __GLX_SINGLE_BEGIN(X_GLsop_GetString,4);
    __GLX_SINGLE_PUT_LONG(0,name);
    __GLX_SINGLE_READ_XREPLY();
    __GLX_SINGLE_GET_SIZE(compsize);
    s = (GLubyte*) Xmalloc(compsize);
    if (!s) {
	/* Throw data on the floor */
	_XEatData(dpy, compsize);
	__glXSetError(gc, GL_OUT_OF_MEMORY);
    } else {
	__GLX_SINGLE_GET_CHAR_ARRAY(s,compsize);

	/*
	** Update local cache
	*/
	switch(name) {
	  case GL_VENDOR:
	    gc->vendor = s;
	    break;
	  case GL_RENDERER:
	    gc->renderer = s;
	    break;
	  case GL_VERSION: {
	     double server_version = strtod((char *)s, NULL);
	     double client_version = strtod(__glXGLClientVersion, NULL);

	     if ( server_version <= client_version ) {
		gc->version = s;
	     }
	     else {
		gc->version = Xmalloc( strlen(__glXGLClientVersion)
				       + strlen((char *)s) + 4 );
		if ( gc->version == NULL ) {
		   /* If we couldn't allocate memory for the new string,
		    * make a best-effort and just copy the client-side version
		    * to the string and use that.  It probably doesn't
		    * matter what is done here.  If there not memory available
		    * for a short string, the system is probably going to die
		    * soon anyway.
		    */
		   strcpy((char *)s, __glXGLClientVersion);
		}
		else {
		   sprintf( (char *)gc->version, "%s (%s)",
			    __glXGLClientVersion, s );
		   Xfree( s );
		   s = gc->version;
		}
	     }
	     break;
	  }
	  case GL_EXTENSIONS:
	    gc->extensions = (GLubyte *)__glXCombineExtensionStrings( (const char *)s, __glXGLClientExtensions );
	    XFree( s );
	    s = gc->extensions;
	    break;
	}
    }
    __GLX_SINGLE_END();
    return s;
}