Esempio n. 1
0
void PrintCertificateDetails(CCertificateInfo* aCertInfo)
	{
	std::cout << "Certificate: " << std::endl;
	PrintWithIndent(std::cout, "Data:", 4);
	std::cout << std::endl;
	int version = aCertInfo->Version();
	PrintWithIndent(std::cout, "Version: ", 8);
	std::cout << version+1 << "(0x" << version << ")" << std::endl;
	PrintWithIndent(std::cout, "Serial Number: ", 8);
	std::cout << aCertInfo->SerialNumber();
	std::cout << std::endl;
	PrintWithIndent(std::cout, "Signature Algorithm: ", 8);
	std::cout << aCertInfo->SignatureAlgo() << std::endl;
	PrintWithIndent(std::wcout, L"Issuer: ", 8);
	std::wcout << aCertInfo->IssuerName(true) << std::endl;
	PrintWithIndent(std::cout, "Validity", 8);
	std::cout << std::endl;
	PrintWithIndent(std::cout, "Not Before: ", 12);
	PrintDateTime(aCertInfo->ValidFrom());
	std::cout << std::endl;
	PrintWithIndent(std::cout, "Not After : ", 12);
	PrintDateTime(aCertInfo->ValidTo());
	std::cout << std::endl;
	PrintWithIndent(std::wcout, L"Subject: ", 8);
	std::wcout << aCertInfo->SubjectName(true) << std::endl;
	PrintWithIndent(std::cout, "Subject Public Key Info:", 8);
	std::cout << std::endl;
	PrintWithIndent(std::cout, "Public Key Algorithm: ", 12);
	std::cout << aCertInfo->PublicKeyAlgo() << std::endl;
	aCertInfo->PrintPublicKey(std::cout, 16);
	const std::vector<TExtension>& extList = aCertInfo->Extensions();
	PrintExtensions(extList, 8);
	aCertInfo->PrintSignature(std::cout, 12);
	}
Esempio n. 2
0
int
main (int argc, char** argv)
{
  GLenum err;
  GLContext ctx;

  /* ---------------------------------------------------------------------- */
  /* parse arguments */
  if (GL_TRUE == ParseArgs(argc-1, argv+1))
  {
#if defined(_WIN32)
    fprintf(stderr, "Usage: visualinfo [-a] [-s] [-h] [-pf <id>]\n");
    fprintf(stderr, "        -a: show all visuals\n");
    fprintf(stderr, "        -s: display to stdout instead of visualinfo.txt\n");
    fprintf(stderr, "        -pf <id>: use given pixelformat\n");
    fprintf(stderr, "        -h: this screen\n");
#else
    fprintf(stderr, "Usage: visualinfo [-h] [-display <display>] [-visual <id>]\n");
    fprintf(stderr, "        -h: this screen\n");
    fprintf(stderr, "        -display <display>: use given display\n");
    fprintf(stderr, "        -visual <id>: use given visual\n");
#endif
    return 1;
  }

  /* ---------------------------------------------------------------------- */
  /* create OpenGL rendering context */
  InitContext(&ctx);
  if (GL_TRUE == CreateContext(&ctx))
  {
    fprintf(stderr, "Error: CreateContext failed\n");
    DestroyContext(&ctx);
    return 1;
  }

  /* ---------------------------------------------------------------------- */
  /* initialize GLEW */
  glewExperimental = GL_TRUE;
#ifdef GLEW_MX
  err = glewContextInit(glewGetContext());
#  ifdef _WIN32
  err = err || wglewContextInit(wglewGetContext());
#  elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
  err = err || glxewContextInit(glxewGetContext());
#  endif
#else
  err = glewInit();
#endif
  if (GLEW_OK != err)
  {
    fprintf(stderr, "Error [main]: glewInit failed: %s\n", glewGetErrorString(err));
    DestroyContext(&ctx);
    return 1;
  }

  /* ---------------------------------------------------------------------- */
  /* open file */
#if defined(_WIN32)
  if (!displaystdout)
    file = fopen("visualinfo.txt", "w");
  if (file == NULL)
    file = stdout;
#else
  file = stdout;
#endif

  /* ---------------------------------------------------------------------- */
  /* output header information */
  /* OpenGL extensions */
  fprintf(file, "OpenGL vendor string: %s\n", glGetString(GL_VENDOR));
  fprintf(file, "OpenGL renderer string: %s\n", glGetString(GL_RENDERER));
  fprintf(file, "OpenGL version string: %s\n", glGetString(GL_VERSION));
  fprintf(file, "OpenGL extensions (GL_): \n");
  PrintExtensions((char*)glGetString(GL_EXTENSIONS));
  /* GLU extensions */
  fprintf(file, "GLU version string: %s\n", gluGetString(GLU_VERSION));
  fprintf(file, "GLU extensions (GLU_): \n");
  PrintExtensions((char*)gluGetString(GLU_EXTENSIONS));

  /* ---------------------------------------------------------------------- */
  /* extensions string */
#if defined(_WIN32)
  /* WGL extensions */
  if (WGLEW_ARB_extensions_string || WGLEW_EXT_extensions_string)
  {
    fprintf(file, "WGL extensions (WGL_): \n");
    PrintExtensions(wglGetExtensionsStringARB ?
                    (char*)wglGetExtensionsStringARB(ctx.dc) :
            (char*)wglGetExtensionsStringEXT());
  }
#elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX)

#else
  /* GLX extensions */
  fprintf(file, "GLX extensions (GLX_): \n");
  PrintExtensions(glXQueryExtensionsString(glXGetCurrentDisplay(),
                                           DefaultScreen(glXGetCurrentDisplay())));
#endif

  /* ---------------------------------------------------------------------- */
  /* enumerate all the formats */
  VisualInfo(&ctx);

  /* ---------------------------------------------------------------------- */
  /* release resources */
  DestroyContext(&ctx);
  if (file != stdout)
    fclose(file);
  return 0;
}
Esempio n. 3
0
 // TODO: Size has default constructor, that initializes to 0. Is initialization required here?
 RenderingEngine::RenderingEngine(): m_drawingController(nullptr) {
     m_touches = new vector<Touch *>;
     
     PrintExtensions();
 }
Esempio n. 4
0
//
// CreateOpenGL
//
bool CreateOpenGL(int *pWidth, int *pHeight, int MSAASamples)
{
    g_Display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
    if (EGL_NO_DISPLAY == g_Display)
    {
        puts("Failed to retrieve EGL display connection.");
        return false;
    }

    eglBindAPI(EGL_OPENGL_ES_API);
    EGLint Error = eglGetError();
    if (Error != EGL_SUCCESS) {
        printf("eglBindAPI(EGL_OPENGL_ES_API) failed: %s\n", StringifyEGLError(Error));
        return false;
    }

    EGLint MajorNumber = 0;
    EGLint MinorNumber = 0;

    if (!eglInitialize(g_Display, &MajorNumber, &MinorNumber))
    {
        puts("eglInitialize failed.");
        return false;
    }

    printf("EGL version: %d.%d\n", MajorNumber, MinorNumber);

    std::vector<int> Attribs;

    Attribs.push_back(EGL_RED_SIZE);
    Attribs.push_back(8);
    Attribs.push_back(EGL_GREEN_SIZE);
    Attribs.push_back(8);
    Attribs.push_back(EGL_BLUE_SIZE);
    Attribs.push_back(8);
    Attribs.push_back(EGL_ALPHA_SIZE);
    Attribs.push_back(8);
    Attribs.push_back(EGL_DEPTH_SIZE);
    Attribs.push_back(24);
    Attribs.push_back(EGL_STENCIL_SIZE);
    Attribs.push_back(8);
    Attribs.push_back(EGL_SURFACE_TYPE);
    Attribs.push_back(EGL_WINDOW_BIT);
    Attribs.push_back(EGL_RENDERABLE_TYPE);
    Attribs.push_back(EGL_OPENGL_ES2_BIT);
    if (MSAASamples > 1)
    {
        puts("Requesting MSAA config...");
        Attribs.push_back(EGL_SAMPLE_BUFFERS);
        Attribs.push_back(1);
        Attribs.push_back(EGL_SAMPLES);
        Attribs.push_back(MSAASamples);
    }
    Attribs.push_back(EGL_NONE);

    EGLConfig Config;
    EGLint NumConfigs = 0;

    if (!eglChooseConfig(g_Display, &Attribs[0], &Config, 1, &NumConfigs) || (0 == NumConfigs))
    {
        puts("eglChooseConfig failed.");
        return false;
    }

    printf("Number of framebuffer configurations that matches criteria: %d\n", NumConfigs);

    g_Surface = eglCreateWindowSurface(g_Display, Config, (NativeWindowType)0, NULL);
    if (EGL_NO_SURFACE == g_Surface)
    {
        puts("eglCreateWindowSurface() failed.");
        return false;
    }

    const EGLint ContextAttribs[] =
    {
        EGL_CONTEXT_CLIENT_VERSION, 2,
        EGL_NONE
    };

    g_Context = eglCreateContext(g_Display, Config, EGL_NO_CONTEXT, ContextAttribs);
    if (EGL_NO_CONTEXT == g_Context)
    {
        EGLint Error = eglGetError();
        printf("eglCreateContext failed: %s\n", StringifyEGLError(Error));
        return false;
    }

    if (!eglMakeCurrent(g_Display, g_Surface, g_Surface, g_Context))
    {
        puts("Failed to make rendering context current.");
        return false;
    }

    EGLint Width = 0;
    EGLint Height = 0;
    EGLint HorizontalResolution = 0;
    EGLint VerticalResolution = 0;
    EGLint PixelAspectRatio = 0;
    EGLint SwapBehavior = 0;
    EGLint MultisampleResolve = 0;

    eglQuerySurface(g_Display, g_Surface, EGL_WIDTH, &Width);
    eglQuerySurface(g_Display, g_Surface, EGL_HEIGHT, &Height);
    eglQuerySurface(g_Display, g_Surface, EGL_VERTICAL_RESOLUTION, &VerticalResolution);
    eglQuerySurface(g_Display, g_Surface, EGL_HORIZONTAL_RESOLUTION, &HorizontalResolution);
    eglQuerySurface(g_Display, g_Surface, EGL_PIXEL_ASPECT_RATIO, &PixelAspectRatio);
    eglQuerySurface(g_Display, g_Surface, EGL_SWAP_BEHAVIOR, &SwapBehavior);
    eglQuerySurface(g_Display, g_Surface, EGL_MULTISAMPLE_RESOLVE, &MultisampleResolve);

    printf(
        "EGL_WIDTH: %d\n"
        "EGL_HEIGHT: %d\n"
        "EGL_VERTICAL_RESOLUTION: %d\n"
        "EGL_HORIZONTAL_RESOLUTION: %d\n"
        "EGL_PIXEL_ASPECT_RATIO: %d\n"
        "EGL_SWAP_BEHAVIOR: %s\n"
        "EGL_MULTISAMPLE_RESOLVE: %s\n",
        Width,
        Height,
        VerticalResolution,
        HorizontalResolution,
        PixelAspectRatio,
        (EGL_BUFFER_PRESERVED==SwapBehavior) ? "EGL_BUFFER_PRESERVED" : "EGL_BUFFER_DESTROYED",
        (EGL_MULTISAMPLE_RESOLVE_DEFAULT==MultisampleResolve) ? "EGL_MULTISAMPLE_RESOLVE_DEFAULT" : "EGL_MULTISAMPLE_RESOLVE_BOX");

    printf("\n");
    printf("EGL_VENDOR: %s\n", eglQueryString(g_Display, EGL_VENDOR));
    printf("EGL_VERSION: %s\n", eglQueryString(g_Display, EGL_VERSION));
    PrintExtensions(eglQueryString(g_Display, EGL_EXTENSIONS));
    PrintExtensions((const char *)glGetString(GL_EXTENSIONS));

    *pWidth = Width;
    *pHeight = Height;

    // Store for HUD
    g_MSAASamples = MSAASamples;

    return true;
}