Results 1 to 2 of 2

Thread: What can you tell from this?

  1. #1
    Junior Member
    Join Date
    Oct 2007
    Posts
    2

    What can you tell from this?

    I am amidst porting OGLES to Linux. I have made some good progress. When I do eglGetDisplay() I am passing the parameter of '(void*)"/dev/fb/0"'. The function succeeds, if I pass a parameter of NULL, the function fails. (any comments yet?)

    I go thru the subsequent steps of setting up EGL and I clear the COLOR_BUFFER_BIT. In my egl.cpp, I modified my glSwapBuffers() to write the color buffer to a file. My mode is RGB565. I am able to copy this file into "/dev/fb/0" via a terminal, and voila!, my cleared color is displayed on the LCD.

    But, if I try to draw a polygon and then display it using the above method, it still has only the cleared color.

    Code:
    Code :
    int main(int argc, char** argv)
    {
    	EGLConfig myConfig;
     
    static const char sAppName[] =
        "OpenGL Test (Linux)";
        static EGLConfig sEglConfig;
          EGLBoolean success;
        EGLint numConfigs;
        EGLint majorVersion;
        EGLint minorVersion;
     
     
    	EGLint num_config = 1;
    	EGLint attrib_list[] = { EGL_ALPHA_SIZE, 0, EGL_RED_SIZE, 5,
    		EGL_GREEN_SIZE, 6, EGL_BLUE_SIZE, 5, EGL_DEPTH_SIZE, 16,
    		EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_NONE };
     
    	EGLDisplay m_eglDisplay = EGL_NO_DISPLAY;
    	EGLSurface m_eglSurface = EGL_NO_SURFACE;
    	EGLContext m_eglContext = EGL_NO_CONTEXT;
     
    	printf("Trying to get Display!\n");
    	m_eglDisplay = eglGetDisplay((void*)"/dev/fb/0");
    	if (m_eglDisplay == EGL_NO_DISPLAY || eglGetError() != EGL_SUCCESS)
    	printf("It failed up on eglGetDisplay!\n");
    	else
    	printf("It passed on eglGetDisplay!\n");
     
     
    	printf("Trying to initialize the Display!\n");
    	if (eglInitialize(m_eglDisplay, 0, 0) == EGL_FALSE || eglGetError() != EGL_SUCCESS)
    	printf("It failed up on initializing eglGetDisplay!\n");
    	else
    	printf("It passed on initializing eglGetDisplay!\n");
     
     
    	 if (success != EGL_FALSE)
            success = eglGetConfigs(m_eglDisplay, NULL, 0, &num_config);
        if (success != EGL_FALSE)
            success = eglChooseConfig(m_eglDisplay, attrib_list, &myConfig, 1, &num_config);
     
    			printf("Trying to get Context!\n");
    	m_eglContext = eglCreateContext(m_eglDisplay, myConfig, 0, 0);
     
    	if (m_eglContext == EGL_NO_CONTEXT || eglGetError() != EGL_SUCCESS)
    	printf("It failed up on eglCreateContext!\n");
    	else
    	printf("It passed on eglCreateContext!\n");
     
     
      m_eglSurface = eglCreateWindowSurface(m_eglDisplay, myConfig, 0, 0);
     
    	printf("Trying to get Surface!\n");
    	if (m_eglSurface == EGL_NO_SURFACE || eglGetError() != EGL_SUCCESS)
    	printf("It failed up on eglCreateWindowSurface!\n");
    	else
    	printf("It passed on eglCreateWindowSurface!\n");
     
    	eglMakeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext);
     
     
     
    	  const static GLfloat v[] = {
    	0.25, 0.25, 0.0,
    	0.75, 0.25, 0.0,
    	0.25, 0.75, 0.0,
    	0.75, 0.75, 0.0
        };
     
          glMatrixMode(GL_PROJECTION);
       glLoadIdentity();
       glOrthof(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
       glVertexPointer(3, GL_FLOAT, 0, v);
       glEnableClientState(GL_VERTEX_ARRAY);
     
    	/// display graphic ///
     
     	glClearColor(0.0, 1.0, 0.0, 1.0);
        glClear(GL_COLOR_BUFFER_BIT);
     
       glColor4f (1.0, 0.0, 0.0, 1.0);
       glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
     
       /////
       glFlush();
        eglSwapBuffers(m_eglDisplay, m_eglSurface);  // actually write to the RGB 16-bit file
     
     
       return 0;
    }
    [/code]

  2. #2
    Senior Member
    Join Date
    Sep 2003
    Location
    Seattle, WA
    Posts
    246
    Is directfb or SDL available on your device? That should be easier, because the Surface class would simply become a wrapper around whatever this underlying API gives you.

    - HM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •