当前位置: 首页>>代码示例>>C++>>正文


C++ eglGetError函数代码示例

本文整理汇总了C++中eglGetError函数的典型用法代码示例。如果您正苦于以下问题:C++ eglGetError函数的具体用法?C++ eglGetError怎么用?C++ eglGetError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了eglGetError函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: init_eglpbuffer

int init_eglpbuffer(/*out*/eglpbuffer_t * eglpbuf, struct opengl_display_t * egldisp, struct opengl_config_t * eglconf, uint32_t width, uint32_t height)
{
   int err;
   EGLint attr[] = {
      EGL_HEIGHT, height > INT32_MAX ? INT32_MAX : (int32_t)height,
      EGL_WIDTH,  width  > INT32_MAX ? INT32_MAX : (int32_t)width,
      EGL_NONE
   };
   EGLSurface surface = eglCreatePbufferSurface(egldisp, eglconf, attr);

   if (EGL_NO_SURFACE == surface) {
      goto ONERR;
   }

   *eglpbuf = surface;

   return 0;
ONERR:
   err = convert2errno_egl(eglGetError());
   TRACEEXIT_ERRLOG(err);
   return err;
}
开发者ID:je-so,项目名称:js-projekt,代码行数:22,代码来源:eglpbuffer.c

示例2: free_eglpbuffer

int free_eglpbuffer(eglpbuffer_t * eglpbuf, struct opengl_display_t * egldisp)
{
   int err;

   if (*eglpbuf) {
      EGLBoolean isDestoyed = eglDestroySurface(egldisp, *eglpbuf);

      *eglpbuf = 0;

      if (EGL_FALSE == isDestoyed) {
         err = convert2errno_egl(eglGetError());
         goto ONERR;
      }

      if (PROCESS_testerrortimer(&s_eglpbuffer_errtimer, &err)) goto ONERR;
   }

   return 0;
ONERR:
   TRACEEXITFREE_ERRLOG(err);
   return err;
}
开发者ID:je-so,项目名称:js-projekt,代码行数:22,代码来源:eglpbuffer.c

示例3: egl_perror

static void
egl_perror(const char *msg) {
    static const char *errmsg[] = {
        "function succeeded",
        "EGL is not initialized, or could not be initialized, for the specified display",
        "cannot access a requested resource",
        "failed to allocate resources for the requested operation",
        "an unrecognized attribute or attribute value was passed in an attribute list",
        "an EGLConfig argument does not name a valid EGLConfig",
        "an EGLContext argument does not name a valid EGLContext",
        "the current surface of the calling thread is no longer valid",
        "an EGLDisplay argument does not name a valid EGLDisplay",
        "arguments are inconsistent",
        "an EGLNativePixmapType argument does not refer to a valid native pixmap",
        "an EGLNativeWindowType argument does not refer to a valid native window",
        "one or more argument values are invalid",
        "an EGLSurface argument does not name a valid surface configured for rendering",
        "a power management event has occurred",
    };

    fprintf(stderr, "%s: %s\n", msg, errmsg[eglGetError() - EGL_SUCCESS]);
}
开发者ID:AVataRR626,项目名称:NDK-Samples,代码行数:22,代码来源:main.c

示例4: Init

EGLint GLContext::Resume(ANativeWindow *window) {
  if (egl_context_initialized_ == false) {
    Init(window, msaa_size_);
    return EGL_SUCCESS;
  }

  int32_t original_widhth = screen_width_;
  int32_t original_height = screen_height_;

  //Create surface
  window_ = window;
  surface_ = eglCreateWindowSurface(display_, config_, window_, NULL);
  eglQuerySurface(display_, surface_, EGL_WIDTH, &screen_width_);
  eglQuerySurface(display_, surface_, EGL_HEIGHT, &screen_height_);

  if (screen_width_ != original_widhth || screen_height_ != original_height) {
    //Screen resized
    LOGI("Screen resized");
  }

  if (eglMakeCurrent(display_, surface_, surface_, context_) == EGL_TRUE)
    return EGL_SUCCESS;

  EGLint err = eglGetError();
  LOGW("Unable to eglMakeCurrent %d", err);

  if (err == EGL_CONTEXT_LOST) {
    //Recreate context
    LOGI("Re-creating egl context");
    InitEGLContext();
  } else {
    //Recreate surface
    Terminate();
    InitEGLSurface();
    InitEGLContext();
  }

  return err;
}
开发者ID:Ratel13,项目名称:cpp-android-basic-samples,代码行数:39,代码来源:GLContext.cpp

示例5: SetUp

    virtual void SetUp() {
        // static const EGLint SURFACE_ATTRIBS[] = {
        //     EGL_NONE
        // };

        mEglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
        ASSERT_NE(EGL_NO_DISPLAY, mEglDisplay);

        EGLint major, minor;
        ASSERT_TRUE(eglInitialize(mEglDisplay, &major, &minor));

        EGLint numConfigs = 0;
        ASSERT_TRUE(eglChooseConfig(mEglDisplay, getConfigAttribs(),
                &mEglConfig, 1, &numConfigs));
        ASSERT_GE(1, numConfigs);
        ASSERT_NE((EGLConfig)0, mEglConfig);

        mEglWindowSurface = eglCreateWindowSurface(mEglDisplay, mEglConfig,
                GLTestHelper::getWindow(), getWindowSurfaceAttribs());
        ASSERT_EQ(EGL_SUCCESS, eglGetError());
        ASSERT_NE(EGL_NO_SURFACE, mEglWindowSurface);
    }
开发者ID:10114395,项目名称:android-5.0.0_r5,代码行数:22,代码来源:EGLCreateContext_test.cpp

示例6: assert

/**
 * \brief Destroy the context.
 *
 * This function is called after power events and at shutdown.
 */
void Main::destroyContext()
{
    assert(eglContext != EGL_NO_CONTEXT);

    // Make sure the context is not current.
    if (eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT) == EGL_FALSE)
    {
        EGLint error = eglGetError();
        if (error == EGL_CONTEXT_LOST)
        {
            Platform::displayMessage("Power event when trying to initialize.  I don't know how to handle this.");
            return;
        }
        Platform::fatalError("eglMakeCurrent failed in Graphics::initializeOpenglState.  Maybe this is normal when power events occur.");
        return;
    }

    // Destroy the context.
    eglDestroyContext(eglDisplay, eglContext);
    checkEglError("eglDestroyContext");
    eglContext = EGL_NO_CONTEXT;
}
开发者ID:Jetblacktsunami,项目名称:seng,代码行数:27,代码来源:Main.cpp

示例7: unbind

// simple support, only for rgba images
PBO& PBO::setup(int nWidth, int nHeight, GLenum nColorType) {
	width = nWidth;
	height = nHeight;
	color_type = nColorType;
	buffer_size = width * height * 4;
	unbind(); // see note in header.
	glBindTexture(GL_TEXTURE_2D, texture_id); eglGetError();
	glEnable(GL_TEXTURE_2D); eglGetError();
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); eglGetError();
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); eglGetError();
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); eglGetError();
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); eglGetError();
	glTexImage2D(
		 GL_TEXTURE_2D, 0
		,GL_RGBA, width, height, 0
        ,color_type, GL_UNSIGNED_BYTE, NULL
	);eglGetError();
	//unbind();
	return *this;
}
开发者ID:arneboon,项目名称:roxlu,代码行数:21,代码来源:PBO.cpp

示例8: eglSwapBuffers

EGLint GLContext::Swap() {
  bool b = eglSwapBuffers(display_, surface_);
  if (!b) {
    EGLint err = eglGetError();
    if (err == EGL_BAD_SURFACE) {
      //Recreate surface
      InitEGLSurface();
      err = EGL_SUCCESS; //Still consider glContext is valid
    } else if (err == EGL_CONTEXT_LOST || err == EGL_BAD_CONTEXT) {
      //Context has been lost!!
      context_valid_ = false;
      Terminate();
      InitEGLContext();
    }

    return err;
  }
  if (restoreInterval_ && swapInterval_ != SWAPINTERVAL_DEFAULT) {
    eglSwapInterval(display_, swapInterval_); //Restore Swap interval
  }
  return EGL_SUCCESS;
}
开发者ID:Ratel13,项目名称:cpp-android-basic-samples,代码行数:22,代码来源:GLContext.cpp

示例9: eglQuerySurface

int MinutesPerGameRenderer::initGL() {

    GLThread::instance()->resize(m_width,m_height);

    //Query width and height of the window surface created by utility code
    EGLint surface_width, surface_height;

    eglQuerySurface(egl_disp, egl_surf, EGL_WIDTH, &surface_width);
    eglQuerySurface(egl_disp, egl_surf, EGL_HEIGHT, &surface_height);

    EGLint err = eglGetError();
    if (err != 0x3000) {
        fprintf(stderr, "Unable to query EGL surface dimensions\n");
        return EXIT_FAILURE;
    }

    glShadeModel(GL_SMOOTH);
    qDebug() << __LINE__ <<"=" << glGetError();
    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    qDebug() << __LINE__ <<"=" << glGetError();

    glViewport(0, 0, surface_width, surface_height);
    qDebug() << __LINE__ <<"=" << glGetError();
    glMatrixMode(GL_PROJECTION);
    qDebug() << __LINE__ <<"=" << glGetError();
    glLoadIdentity();

    glOrthof(0.0f, (float) (surface_width) / (float) (surface_height), 0.0f, 1.0f, -1.0f, 1.0f);

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    glTranslatef((float) (surface_width) / (float) (surface_height) / 2, 0.5f, 0.5f);

    glScalef(0.5f, 0.5f, 0.0f);

    return EXIT_SUCCESS;
}
开发者ID:26filip,项目名称:Cascades-Community-Samples,代码行数:38,代码来源:MinutesPerGameRenderer.cpp

示例10: gst_gl_context_egl_get_error_string

static const gchar *
gst_gl_context_egl_get_error_string (void)
{
  EGLint nErr = eglGetError ();

  switch (nErr) {
    case EGL_SUCCESS:
      return "EGL_SUCCESS";
    case EGL_BAD_DISPLAY:
      return "EGL_BAD_DISPLAY";
    case EGL_NOT_INITIALIZED:
      return "EGL_NOT_INITIALIZED";
    case EGL_BAD_ACCESS:
      return "EGL_BAD_ACCESS";
    case EGL_BAD_ALLOC:
      return "EGL_BAD_ALLOC";
    case EGL_BAD_ATTRIBUTE:
      return "EGL_BAD_ATTRIBUTE";
    case EGL_BAD_CONFIG:
      return "EGL_BAD_CONFIG";
    case EGL_BAD_CONTEXT:
      return "EGL_BAD_CONTEXT";
    case EGL_BAD_CURRENT_SURFACE:
      return "EGL_BAD_CURRENT_SURFACE";
    case EGL_BAD_MATCH:
      return "EGL_BAD_MATCH";
    case EGL_BAD_NATIVE_PIXMAP:
      return "EGL_BAD_NATIVE_PIXMAP";
    case EGL_BAD_NATIVE_WINDOW:
      return "EGL_BAD_NATIVE_WINDOW";
    case EGL_BAD_PARAMETER:
      return "EGL_BAD_PARAMETER";
    case EGL_BAD_SURFACE:
      return "EGL_BAD_SURFACE";
    default:
      return "unknown";
  }
}
开发者ID:ego5710,项目名称:gst-plugins-bad,代码行数:38,代码来源:gstglcontext_egl.c

示例11: eglGetError

/*******************************************************************************
 * Function Name  : StringFrom_eglGetError
 * Returns        : A string
 * Description    : Returns a string representation of an egl error
 *******************************************************************************/
const char *PVRShellInitAPI::StringFrom_eglGetError() const
{
	EGLint nErr = eglGetError();

	switch(nErr)
	{
		case EGL_SUCCESS:
			return "EGL_SUCCESS";
		case EGL_BAD_DISPLAY:
			return "EGL_BAD_DISPLAY";
		case EGL_NOT_INITIALIZED:
			return "EGL_NOT_INITIALIZED";
		case EGL_BAD_ACCESS:
			return "EGL_BAD_ACCESS";
		case EGL_BAD_ALLOC:
			return "EGL_BAD_ALLOC";
		case EGL_BAD_ATTRIBUTE:
			return "EGL_BAD_ATTRIBUTE";
		case EGL_BAD_CONFIG:
			return "EGL_BAD_CONFIG";
		case EGL_BAD_CONTEXT:
			return "EGL_BAD_CONTEXT";
		case EGL_BAD_CURRENT_SURFACE:
			return "EGL_BAD_CURRENT_SURFACE";
		case EGL_BAD_MATCH:
			return "EGL_BAD_MATCH";
		case EGL_BAD_NATIVE_PIXMAP:
			return "EGL_BAD_NATIVE_PIXMAP";
		case EGL_BAD_NATIVE_WINDOW:
			return "EGL_BAD_NATIVE_WINDOW";
		case EGL_BAD_PARAMETER:
			return "EGL_BAD_PARAMETER";
		case EGL_BAD_SURFACE:
			return "EGL_BAD_SURFACE";
		default:
			return "unknown";
	}
}
开发者ID:zhurb88,项目名称:PVR-OGLES2.0,代码行数:43,代码来源:PVRShellAPI.cpp

示例12: createBCMPixmapSurface

EGLSurface createBCMPixmapSurface(EGLDisplay display, EGLConfig config)
{
    EGLint pixel_format = EGL_PIXEL_FORMAT_ARGB_8888_BRCM;
    EGLint rt;
    eglGetConfigAttrib(display, config, EGL_RENDERABLE_TYPE, &rt);

    if (rt & EGL_OPENGL_ES_BIT) {
        pixel_format |= EGL_PIXEL_FORMAT_RENDER_GLES_BRCM;
        pixel_format |= EGL_PIXEL_FORMAT_GLES_TEXTURE_BRCM;
    }
    if (rt & EGL_OPENGL_ES2_BIT) {
        pixel_format |= EGL_PIXEL_FORMAT_RENDER_GLES2_BRCM;
        pixel_format |= EGL_PIXEL_FORMAT_GLES2_TEXTURE_BRCM;
    }
    if (rt & EGL_OPENVG_BIT) {
        pixel_format |= EGL_PIXEL_FORMAT_RENDER_VG_BRCM;
        pixel_format |= EGL_PIXEL_FORMAT_VG_IMAGE_BRCM;
    }
    if (rt & EGL_OPENGL_BIT) {
        pixel_format |= EGL_PIXEL_FORMAT_RENDER_GL_BRCM;
    }

    EGLint pixmap[5];
    pixmap[0] = 0;
    pixmap[1] = 0;
    pixmap[2] = 8;
    pixmap[3] = 8;
    pixmap[4] = pixel_format;

    eglCreateGlobalImageBRCM(8, 8, pixel_format, 0, 8*4, pixmap);

    EGLSurface surface = eglCreatePixmapSurface(display, config, pixmap, 0);
    if ( surface == EGL_NO_SURFACE ) {
        cerr << "Unable to create EGL surface (eglError: " << eglGetError() << ")" << endl;
    }
    return surface;

}
开发者ID:JohnChu,项目名称:libavg,代码行数:38,代码来源:BCMDisplay.cpp

示例13: MY_ASSERT

bool NativeEngine::InitSurface() {
    // need a display
    MY_ASSERT(mEglDisplay != EGL_NO_DISPLAY);

    if (mEglSurface != EGL_NO_SURFACE) {
        // nothing to do
        LOGD("NativeEngine: no need to init surface (already had one).");
        return true;
    }
        
    LOGD("NativeEngine: initializing surface.");
    
    EGLint numConfigs;

    const EGLint attribs[] = {
            EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, // request OpenGL ES 2.0
            EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
            EGL_BLUE_SIZE, 8,
            EGL_GREEN_SIZE, 8,
            EGL_RED_SIZE, 8,
            EGL_DEPTH_SIZE, 16,
            EGL_NONE
    };

    // since this is a simple sample, we have a trivial selection process. We pick
    // the first EGLConfig that matches:
    eglChooseConfig(mEglDisplay, attribs, &mEglConfig, 1, &numConfigs);

    // create EGL surface
    mEglSurface = eglCreateWindowSurface(mEglDisplay, mEglConfig, mApp->window, NULL);
    if (mEglSurface == EGL_NO_SURFACE) {
        LOGE("Failed to create EGL surface, EGL error %d", eglGetError());
        return false;
    }

    LOGD("NativeEngine: successfully initialized surface.");
    return true;
}
开发者ID:AcmeNinjaCorp,项目名称:android-ndk,代码行数:38,代码来源:native_engine.cpp

示例14: if

EGLImageKHR GLConsumer::createImage(EGLDisplay dpy,
        const sp<GraphicBuffer>& graphicBuffer, const Rect& crop) {
    EGLClientBuffer cbuf = (EGLClientBuffer)graphicBuffer->getNativeBuffer();
    EGLint attrs[] = {
        EGL_IMAGE_PRESERVED_KHR,        EGL_TRUE,
        EGL_IMAGE_CROP_LEFT_ANDROID,    crop.left,
        EGL_IMAGE_CROP_TOP_ANDROID,     crop.top,
        EGL_IMAGE_CROP_RIGHT_ANDROID,   crop.right,
        EGL_IMAGE_CROP_BOTTOM_ANDROID,  crop.bottom,
        EGL_NONE,
    };
    if (!crop.isValid()) {
        // No crop rect to set, so terminate the attrib array before the crop.
        attrs[2] = EGL_NONE;
    } else if (!isEglImageCroppable(crop)) {
        // The crop rect is not at the origin, so we can't set the crop on the
        // EGLImage because that's not allowed by the EGL_ANDROID_image_crop
        // extension.  In the future we can add a layered extension that
        // removes this restriction if there is hardware that can support it.
        attrs[2] = EGL_NONE;
    }
    EGLImageKHR image = eglCreateImageKHR(dpy, EGL_NO_CONTEXT,
            EGL_NATIVE_BUFFER_ANDROID, cbuf, attrs);
    if (image == EGL_NO_IMAGE_KHR) {
        EGLint error = eglGetError();
        ST_LOGE("error creating EGLImage: %#x", error);
    }
#ifndef MTK_DEFAULT_AOSP
    else {
        // add log for eglImage created
        ST_LOGI("[%s]", __func__);
        ALOGD("    GraphicBuffer: gb=%p handle=%p fmt=%d",
            graphicBuffer.get(), graphicBuffer->handle, graphicBuffer->format);
        ALOGD("    EGLImage: dpy=%p, img=%p", mEglDisplay, image);
    }
#endif
    return image;
}
开发者ID:WayWingsDev,项目名称:Source_MT6582,代码行数:38,代码来源:GLConsumer.cpp

示例15: checkErrorEGL

static EGLenum checkErrorEGL(const char* msg)
{
	GP_ASSERT(msg);
	static const char* errmsg[] =
			{ "EGL function succeeded",
					"EGL is not initialized, or could not be initialized, for the specified display",
					"EGL cannot access a requested resource",
					"EGL failed to allocate resources for the requested operation",
					"EGL fail to access an unrecognized attribute or attribute value was passed in an attribute list",
					"EGLConfig argument does not name a valid EGLConfig",
					"EGLContext argument does not name a valid EGLContext",
					"EGL current surface of the calling thread is no longer valid",
					"EGLDisplay argument does not name a valid EGLDisplay",
					"EGL arguments are inconsistent",
					"EGLNativePixmapType argument does not refer to a valid native pixmap",
					"EGLNativeWindowType argument does not refer to a valid native window",
					"EGL one or more argument values are invalid",
					"EGLSurface argument does not name a valid surface configured for rendering",
					"EGL power management event has occurred", };
	EGLenum error = eglGetError();
	LOGI("%s: %s.", msg, errmsg[error - EGL_SUCCESS]);
	return error;
}
开发者ID:ARVOS-APP,项目名称:ArViewerGameplay,代码行数:23,代码来源:Renderer.cpp


注:本文中的eglGetError函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。