Pickle
Mega GP Mania
To keep the forums flooded with the opengl questions im starting this thread about it. Im not an opengl expert by any means but I can probably get someone who at least started with wiz's opengl method.
1. You need the opengl es library called libopengles_lite.so, this should do in /lib. The rar on the archive has a installer script to do so.
2. The libopengles_lite.so has function calls that need to be defined by the application or another library. I created a library to do this and called it libwizGLES.so. There source floating around in a file called port.cpp which has all of the functions. You can find this in the opengl es demos archive. You can also get the prebuilt shared library built by me in the latest glquake beta. (it also has nanogl shared lib too if you want that)
pickle.gp2x.de/glquake.zip
3. Initializing Opengl-es
global variables (use attrib_list_fsaa for fsaa)
CODE
EGLDisplay glDisplay;
EGLConfig glConfig;
EGLContext glContext;
EGLSurface glSurface;
NativeWindowType hNativeWnd = 0;
const char *gl_vendor;
const char *gl_renderer;
const char *gl_version;
const char *gl_extensions;
EGLint attrib_list_fsaa[] =
{
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_BUFFER_SIZE, 0,
EGL_DEPTH_SIZE, 16,
EGL_SAMPLE_BUFFERS, 1,
EGL_SAMPLES, 4,
EGL_NONE
};
EGLint attrib_list[] =
{
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_BUFFER_SIZE, 0,
EGL_DEPTH_SIZE, 16,
EGL_NONE
};
Start egl and get the surface (take notice OS_CreateWindow(), this is in libwizGLES)
CODE
EGLint numConfigs;
EGLint majorVersion;
EGLint minorVersion;
// Create native window.
printf( "VID_Init: Creating the window\n" );
hNativeWnd = OS_CreateWindow();
if(!hNativeWnd)
printf( "VID_Init: OS_CreateWindow Failed\n" );
glDisplay = eglGetDisplay( (NativeDisplayType)0 );
if( glDisplay == EGL_NO_DISPLAY )
{
printf( "GL No Display failed\n" );
}
if( !eglInitialize( glDisplay, &majorVersion, &minorVersion ) )
{
printf( "GL Init failed\n" );
}
if( !eglChooseConfig( glDisplay, attrib_list, &glConfig, 1, &numConfigs ) )
{
printf( "GL Config failed\n" );
}
glContext = eglCreateContext( glDisplay, glConfig, NULL, NULL );
if( glContext==0 )
{
printf( "GL Context failed\n" );
}
glSurface = eglCreateWindowSurface( glDisplay, glConfig, hNativeWnd, NULL );
if( glSurface==0 )
{
printf( "GL Surface failed\n" );
}
printf( "EGL Init Completed\n" );
eglMakeCurrent( glDisplay, glSurface, glSurface, glContext );
gl_vendor = (const char*)glGetString (GL_VENDOR);
printf("GL_VENDOR: %s\n", gl_vendor);
gl_renderer = (const char*)glGetString (GL_RENDERER);
printf("GL_RENDERER: %s\n", gl_renderer);
gl_version = (const char*)glGetString (GL_VERSION);
printf("GL_VERSION: %s\n", gl_version);
gl_extensions = (const char*)glGetString (GL_EXTENSIONS);
printf("GL_EXTENSIONS: %s\n", gl_extensions);
Flip the framebuffer
CODE
eglSwapBuffers(glDisplay,glSurface);
Thats basically it. Ive also put up the only spec that GPH has leaked.
pickle.gp2x.de/LF1000_spec.pdf
Everything else is opengles, this should be all for the wiz specifics. I hope its of use.
1. You need the opengl es library called libopengles_lite.so, this should do in /lib. The rar on the archive has a installer script to do so.
2. The libopengles_lite.so has function calls that need to be defined by the application or another library. I created a library to do this and called it libwizGLES.so. There source floating around in a file called port.cpp which has all of the functions. You can find this in the opengl es demos archive. You can also get the prebuilt shared library built by me in the latest glquake beta. (it also has nanogl shared lib too if you want that)
pickle.gp2x.de/glquake.zip
3. Initializing Opengl-es
global variables (use attrib_list_fsaa for fsaa)
CODE
EGLDisplay glDisplay;
EGLConfig glConfig;
EGLContext glContext;
EGLSurface glSurface;
NativeWindowType hNativeWnd = 0;
const char *gl_vendor;
const char *gl_renderer;
const char *gl_version;
const char *gl_extensions;
EGLint attrib_list_fsaa[] =
{
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_BUFFER_SIZE, 0,
EGL_DEPTH_SIZE, 16,
EGL_SAMPLE_BUFFERS, 1,
EGL_SAMPLES, 4,
EGL_NONE
};
EGLint attrib_list[] =
{
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_BUFFER_SIZE, 0,
EGL_DEPTH_SIZE, 16,
EGL_NONE
};
Start egl and get the surface (take notice OS_CreateWindow(), this is in libwizGLES)
CODE
EGLint numConfigs;
EGLint majorVersion;
EGLint minorVersion;
// Create native window.
printf( "VID_Init: Creating the window\n" );
hNativeWnd = OS_CreateWindow();
if(!hNativeWnd)
printf( "VID_Init: OS_CreateWindow Failed\n" );
glDisplay = eglGetDisplay( (NativeDisplayType)0 );
if( glDisplay == EGL_NO_DISPLAY )
{
printf( "GL No Display failed\n" );
}
if( !eglInitialize( glDisplay, &majorVersion, &minorVersion ) )
{
printf( "GL Init failed\n" );
}
if( !eglChooseConfig( glDisplay, attrib_list, &glConfig, 1, &numConfigs ) )
{
printf( "GL Config failed\n" );
}
glContext = eglCreateContext( glDisplay, glConfig, NULL, NULL );
if( glContext==0 )
{
printf( "GL Context failed\n" );
}
glSurface = eglCreateWindowSurface( glDisplay, glConfig, hNativeWnd, NULL );
if( glSurface==0 )
{
printf( "GL Surface failed\n" );
}
printf( "EGL Init Completed\n" );
eglMakeCurrent( glDisplay, glSurface, glSurface, glContext );
gl_vendor = (const char*)glGetString (GL_VENDOR);
printf("GL_VENDOR: %s\n", gl_vendor);
gl_renderer = (const char*)glGetString (GL_RENDERER);
printf("GL_RENDERER: %s\n", gl_renderer);
gl_version = (const char*)glGetString (GL_VERSION);
printf("GL_VERSION: %s\n", gl_version);
gl_extensions = (const char*)glGetString (GL_EXTENSIONS);
printf("GL_EXTENSIONS: %s\n", gl_extensions);
Flip the framebuffer
CODE
eglSwapBuffers(glDisplay,glSurface);
Thats basically it. Ive also put up the only spec that GPH has leaked.
pickle.gp2x.de/LF1000_spec.pdf
Everything else is opengles, this should be all for the wiz specifics. I hope its of use.