コード例 #1
0
ファイル: Texture.cpp プロジェクト: naohisas/KVS
void Texture::copySubImage1D( GLint x, GLint y, GLsizei width, GLint xoffset )
{
    KVS_ASSERT( m_target == GL_TEXTURE_1D );
    KVS_ASSERT( this->isBound() );

    const GLint level = 0; // level-of-detail number
    KVS_GL_CALL( glCopyTexSubImage1D( m_target, level, xoffset, x, y, width ) );
}
コード例 #2
0
    virtual void renderFinished(const Camera*)
    {
      GLCHECK4()
      CHECK(texture()->dimension() == TD_TEXTURE_1D)

      glDrawBuffer(drawBuffer()); GLCHECK4()
      glBindTexture(TD_TEXTURE_1D, texture()->handle() ); GLCHECK4()
      glCopyTexSubImage1D(TD_TEXTURE_1D, level(), xoffset(), x(), y(), width()); GLCHECK4()
      glBindTexture(TD_TEXTURE_1D, 0 ); GLCHECK4()
    }
コード例 #3
0
ファイル: Texture.cpp プロジェクト: mutexre/Base
void GL::Texture::copySubImage1D(TextureTarget target, GLint level,
                                 GLint xOffset,
                                 GLint x, GLint y,
                                 GLsizei width)
{
    glCopyTexSubImage1D(GLenum(target), level,
                        xOffset,
                        x, y,
                        width);
}
コード例 #4
0
ファイル: g_render.c プロジェクト: aosm/X11
void __glXDisp_CopyTexSubImage1D(GLbyte *pc)
{
	glCopyTexSubImage1D( 
		*(GLenum   *)(pc + 0),
		*(GLint    *)(pc + 4),
		*(GLint    *)(pc + 8),
		*(GLint    *)(pc + 12),
		*(GLint    *)(pc + 16),
		*(GLsizei  *)(pc + 20)
	);
}
コード例 #5
0
ファイル: Texture.cpp プロジェクト: EvaLan/overview
void CTexture::UpdateCopy(int x, int y, int nWidth, int nHeight, int nOffx, int nOffy, int nOffz)
{
	Bind();
	switch(m_nType)
	{
		case GL_TEXTURE_1D:
			glCopyTexSubImage1D(GL_TEXTURE_1D, 0, nOffx, x, y, nWidth);
			break;
		case GL_TEXTURE_2D:
			glCopyTexSubImage2D(GL_TEXTURE_2D, 0, nOffx, nOffy, x, y, nWidth, nHeight);
			break;
	}
}
コード例 #6
0
	void GLTextureBuffer::copyFromFramebuffer(UINT32 zoffset)
	{
		glBindTexture(mTarget, mTextureID);
		switch(mTarget)
		{
		case GL_TEXTURE_1D:
			glCopyTexSubImage1D(mFaceTarget, mLevel, 0, 0, 0, mWidth);
			break;
		case GL_TEXTURE_2D:
		case GL_TEXTURE_CUBE_MAP:
			glCopyTexSubImage2D(mFaceTarget, mLevel, 0, 0, 0, 0, mWidth, mHeight);
			break;
		case GL_TEXTURE_3D:
			glCopyTexSubImage3D(mFaceTarget, mLevel, 0, 0, zoffset, 0, 0, mWidth, mHeight);
			break;
		}
	}
コード例 #7
0
ファイル: glws_glx.cpp プロジェクト: ShuangxueBai/apitrace
// For GLX, we implement wglBindTexARB() as a copy operation.
// We copy the pbuffer image to the currently bound texture.
// If there's any rendering to the pbuffer before the wglReleaseTexImage()
// call, the results are undefined (and permitted by the extension spec).
//
// The spec says that glTexImage and glCopyTexImage calls which effect
// the pbuffer/texture should not be allowed, but we do not enforce that.
//
// The spec says that when a pbuffer is released from the texture that
// the contents do not have to be preserved.  But that's what will happen
// since we're copying here.
bool
bindTexImage(Drawable *pBuffer, int iBuffer) {
    GLint readBufSave;
    GLint width, height;

    assert(pBuffer->pbuffer);

    // Save the current drawing surface and bind the pbuffer surface
    GLXDrawable prevDrawable = glXGetCurrentDrawable();
    GLXContext prevContext = glXGetCurrentContext();
    GlxDrawable *glxPBuffer = static_cast<GlxDrawable *>(pBuffer);
    glXMakeCurrent(display, glxPBuffer->drawable, prevContext);

    glGetIntegerv(GL_READ_BUFFER, &readBufSave);

    assert(iBuffer == GL_FRONT_LEFT ||
           iBuffer == GL_BACK_LEFT ||
           iBuffer == GL_FRONT_RIGHT ||
           iBuffer == GL_BACK_RIGHT ||
           iBuffer == GL_AUX0);

    // set src buffer
    glReadBuffer(iBuffer);

    // Just copy image from pbuffer to texture
    switch (pBuffer->pbInfo.texTarget) {
    case GL_TEXTURE_1D:
        glGetTexLevelParameteriv(GL_TEXTURE_1D, pBuffer->mipmapLevel,
                                 GL_TEXTURE_WIDTH, &width);
        if (width == pBuffer->width) {
            // replace existing texture
            glCopyTexSubImage1D(GL_TEXTURE_1D,
                                pBuffer->mipmapLevel,
                                0,    // xoffset
                                0, 0, // x, y
                                pBuffer->width);
        } else {
            // define initial texture
            glCopyTexImage1D(GL_TEXTURE_1D,
                             pBuffer->mipmapLevel,
                             pBuffer->pbInfo.texFormat,
                             0, 0, // x, y
                             pBuffer->width, 0);
        }
        break;
    case GL_TEXTURE_2D:
        glGetTexLevelParameteriv(GL_TEXTURE_2D, pBuffer->mipmapLevel,
                                 GL_TEXTURE_WIDTH, &width);
        glGetTexLevelParameteriv(GL_TEXTURE_2D, pBuffer->mipmapLevel,
                                 GL_TEXTURE_HEIGHT, &height);
        if (width == pBuffer->width && height == pBuffer->height) {
            // replace existing texture
            glCopyTexSubImage2D(GL_TEXTURE_2D,
                                pBuffer->mipmapLevel,
                                0, 0, // xoffset, yoffset
                                0, 0, // x, y
                                pBuffer->width, pBuffer->height);
        } else {
            // define initial texture
            glCopyTexImage2D(GL_TEXTURE_2D,
                             pBuffer->mipmapLevel,
                             pBuffer->pbInfo.texFormat,
                             0, 0, // x, y
                             pBuffer->width, pBuffer->height, 0);
        }
        break;
    case GL_TEXTURE_CUBE_MAP:
        {
            const GLenum target =
                GL_TEXTURE_CUBE_MAP_POSITIVE_X + pBuffer->cubeFace;
            glGetTexLevelParameteriv(target, pBuffer->mipmapLevel,
                                     GL_TEXTURE_WIDTH, &width);
            glGetTexLevelParameteriv(target, pBuffer->mipmapLevel,
                                     GL_TEXTURE_HEIGHT, &height);
            if (width == pBuffer->width && height == pBuffer->height) {
                // replace existing texture
                glCopyTexSubImage2D(target,
                                    pBuffer->mipmapLevel,
                                    0, 0, // xoffset, yoffset
                                    0, 0, // x, y
                                    pBuffer->width, pBuffer->height);
            } else {
                // define new texture
                glCopyTexImage2D(target,
                                 pBuffer->mipmapLevel,
                                 pBuffer->pbInfo.texFormat,
                                 0, 0, // x, y
                                 pBuffer->width, pBuffer->height, 0);
            }
        }
        break;
    default:
        ; // no op
    }

    // restore
    glReadBuffer(readBufSave);

    // rebind previous drawing surface
    glXMakeCurrent(display, prevDrawable, prevContext);

    return true;
}
コード例 #8
0
ファイル: teximage-errors.c プロジェクト: blaztinn/piglit
/** Test target params to glTexImage functions */
static GLboolean
test_targets(void)
{
   /* all of these should generate GL_INVALID_ENUM */

   glTexImage1D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 0, GL_RGBA, GL_FLOAT, NULL);
   if (!verify_error("glTexImage1D", GL_INVALID_ENUM))
      return GL_FALSE;

   glTexImage2D(GL_TEXTURE_3D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_FLOAT, NULL);
   if (!verify_error("glTexImage2D", GL_INVALID_ENUM))
      return GL_FALSE;

   glTexImage3D(GL_TEXTURE_1D, 0, GL_RGBA, 16, 16, 16, 0, GL_RGBA, GL_FLOAT, NULL);
   if (!verify_error("glTexImage3D", GL_INVALID_ENUM))
      return GL_FALSE;


   glTexSubImage1D(GL_TEXTURE_2D, 0, 6, 10, GL_RGBA, GL_FLOAT, NULL);
   if (!verify_error("glTexSubImage1D", GL_INVALID_ENUM))
      return GL_FALSE;

   glTexSubImage1D(GL_PROXY_TEXTURE_1D, 0, 6, 10, GL_RGBA, GL_FLOAT, NULL);
   if (!verify_error("glTexSubImage1D", GL_INVALID_ENUM))
      return GL_FALSE;

   glTexSubImage2D(GL_PROXY_TEXTURE_2D, 0, 6, 6, 10, 10, GL_RGBA, GL_FLOAT, NULL);
   if (!verify_error("glTexSubImage1D", GL_INVALID_ENUM))
      return GL_FALSE;

   glTexSubImage3D(GL_PROXY_TEXTURE_2D, 0, 6, 6, 6, 10, 10, 10, GL_RGBA, GL_FLOAT, NULL);
   if (!verify_error("glTexSubImage3D", GL_INVALID_ENUM))
      return GL_FALSE;


   glCopyTexImage1D(GL_PROXY_TEXTURE_1D, 0, GL_RGBA, 4, 4, 16, 0);
   if (!verify_error("glCopyTexImage1D", GL_INVALID_ENUM))
      return GL_FALSE;

   glCopyTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_RGBA, 4, 4, 16, 16, 0);
   if (!verify_error("glCopyTexImage2D", GL_INVALID_ENUM))
      return GL_FALSE;

   glCopyTexImage2D(GL_TEXTURE_1D, 0, GL_RGBA, 4, 4, 16, 16, 0);
   if (!verify_error("glCopyTexImage2D", GL_INVALID_ENUM))
      return GL_FALSE;


   glCopyTexSubImage1D(GL_PROXY_TEXTURE_1D, 0, 4, 4, 6, 10);
   if (!verify_error("glCopyTexSubImage1D", GL_INVALID_ENUM))
      return GL_FALSE;

   glCopyTexSubImage2D(GL_PROXY_TEXTURE_2D, 0, 4, 4, 6, 6, 10, 10);
   if (!verify_error("glCopyTexSubImage2D", GL_INVALID_ENUM))
      return GL_FALSE;

   glCopyTexSubImage3D(GL_PROXY_TEXTURE_3D, 0, 4, 4, 4, 6, 6, 10, 10);
   if (!verify_error("glCopyTexSubImage2D", GL_INVALID_ENUM))
      return GL_FALSE;


   return GL_TRUE;
}
コード例 #9
0
ファイル: gl.cpp プロジェクト: dschaefer/swt-opengl
M(void, glCopyTexSubImage1D, jint target, jint level, jint xoffset, jint x, jint y, jint width) {
	glCopyTexSubImage1D(target, level, xoffset, x, y, width);
}
コード例 #10
0
ファイル: teximage-errors.c プロジェクト: RAOF/piglit
PIGLIT_GL_TEST_CONFIG_END



/** Test target params to glTexImage functions */
static GLboolean
test_targets(void)
{
   /* all of these should generate GL_INVALID_ENUM */

   glTexImage1D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 0, GL_RGBA, GL_FLOAT, NULL);
   if (!piglit_check_gl_error(GL_INVALID_ENUM))
      return GL_FALSE;

   glTexImage2D(GL_TEXTURE_3D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_FLOAT, NULL);
   if (!piglit_check_gl_error(GL_INVALID_ENUM))
      return GL_FALSE;

   glTexImage3D(GL_TEXTURE_1D, 0, GL_RGBA, 16, 16, 16, 0, GL_RGBA, GL_FLOAT, NULL);
   if (!piglit_check_gl_error(GL_INVALID_ENUM))
      return GL_FALSE;


   glTexSubImage1D(GL_TEXTURE_2D, 0, 6, 10, GL_RGBA, GL_FLOAT, NULL);
   if (!piglit_check_gl_error(GL_INVALID_ENUM))
      return GL_FALSE;

   glTexSubImage1D(GL_PROXY_TEXTURE_1D, 0, 6, 10, GL_RGBA, GL_FLOAT, NULL);
   if (!piglit_check_gl_error(GL_INVALID_ENUM))
      return GL_FALSE;

   glTexSubImage2D(GL_PROXY_TEXTURE_2D, 0, 6, 6, 10, 10, GL_RGBA, GL_FLOAT, NULL);
   if (!piglit_check_gl_error(GL_INVALID_ENUM))
      return GL_FALSE;

   glTexSubImage3D(GL_PROXY_TEXTURE_2D, 0, 6, 6, 6, 10, 10, 10, GL_RGBA, GL_FLOAT, NULL);
   if (!piglit_check_gl_error(GL_INVALID_ENUM))
      return GL_FALSE;


   glCopyTexImage1D(GL_PROXY_TEXTURE_1D, 0, GL_RGBA, 4, 4, 16, 0);
   if (!piglit_check_gl_error(GL_INVALID_ENUM))
      return GL_FALSE;

   glCopyTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_RGBA, 4, 4, 16, 16, 0);
   if (!piglit_check_gl_error(GL_INVALID_ENUM))
      return GL_FALSE;

   glCopyTexImage2D(GL_TEXTURE_1D, 0, GL_RGBA, 4, 4, 16, 16, 0);
   if (!piglit_check_gl_error(GL_INVALID_ENUM))
      return GL_FALSE;


   glCopyTexSubImage1D(GL_PROXY_TEXTURE_1D, 0, 4, 4, 6, 10);
   if (!piglit_check_gl_error(GL_INVALID_ENUM))
      return GL_FALSE;

   glCopyTexSubImage2D(GL_PROXY_TEXTURE_2D, 0, 4, 4, 6, 6, 10, 10);
   if (!piglit_check_gl_error(GL_INVALID_ENUM))
      return GL_FALSE;

   glCopyTexSubImage3D(GL_PROXY_TEXTURE_3D, 0, 4, 4, 4, 6, 6, 10, 10);
   if (!piglit_check_gl_error(GL_INVALID_ENUM))
      return GL_FALSE;


   return GL_TRUE;
}
コード例 #11
0
ファイル: directstate.c プロジェクト: ptitSeb/glshim
void gl4es_glCopyMultiTexSubImage1D(GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) {
    text(glCopyTexSubImage1D(target, level, xoffset, x, y, width));
}
コード例 #12
0
ファイル: directstate.c プロジェクト: ptitSeb/glshim
void gl4es_glCopyTextureSubImage1D(GLuint texture, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) {
    text(glCopyTexSubImage1D(target, level, xoffset, x, y, width));
}