Caanoo / WIZ Howto For Opengl-es 1.1 Lite On The Wiz


I have a little question: I can't find gluPerspective function in NanoGL, how can I resolve?
Thanks
 
Well, GLU is just a utility thingy which actually just calls some GL functions. So, take a look at some GLU implementation code and see how it does things.
 
I feel that I'm close to getting this all to work, but am running into a run time issue related to wizGLES. I run my egl test application, I can see the NanoGL wrapping libopengles_lite.so successfully, but once I call eglCreateContext I'm getting a "Symbol lookup error: /lib/libopengles_list.so: undefined symbol GLESOAL_INITALIZE".

I'm compiling wizGLES into an object file, and linking that into my executable. I can do an object dump on my .gpe file, and I can see GLESOAL_INITALIZE in the symbol table:

CODE
...
00019548 g O .bss 00000004 gl_vendor
00008bc4 F *UND* 00000004 _ZNSaIcED1Ev@@GLIBCXX_3.4
00008bd0 F *UND* 00000234 dlerror@@GLIBC_2.0
00019000 g *ABS* 00000000 __init_array_end
000093c0 g F .text 000003f4 GLESOAL_Initalize
00009d14 g F .text 00000050 eglReleaseTexImage
0001955c g *ABS* 00000000 _end
0000a09c g F .text 0000003c glGetString
...


Any ideas on why the library would have problems finding the function at run time?
 
Yeah that happens sometimes for some reason, you can also just compile the port.cpp into your app and it might work that way too. (This is what gph is doing.)
 
In the first post of this thread, you mention that you can find port.cpp in the opengl es demo archive. However, the file in the archive (http://dl.openhandhelds.org/cgi-bin/wiz.cgi?0,1,0,0,23,53) doesn't appear to have any source in it. Is there another place to look for this?
 
Hi pickle, i'm under windows and i'm using code::blocks and the devkitgp2x to compile, I'm having a problem with the libraries that maybe you can solve,
linking with "-lopengles_lite -lwizGLES" gives this error:

Compiling: test.cpp
Linking console executable: bin\Release\WizTest.gpe
..\..\wiz3d/libwizGLES.so: file not recognized: File format not recognized

Trying linking SDL and other libs to be sure it's not some wacky dev enviroment configuration everything works

EDIT: I've recompiled your library using DevkitGP2X... but now i have other problems with the other lib :\ Could you please take a look to this thread Pickle?
http://www.gp32x.de/board/index.php?showtopic=48284 Thanks in advance!
 
Last edited by a moderator:
It seems the demo of Propis uses OpenGL (EGL) to eleminate tearing. It only works correctly with the libopengles_lite.so found in the firmware versions 1.0.0 - 1.1.0. With the old libraries the video output is 90 degree rotated. FW 1.0.1 is necessary, or the screen is rotated too.
So the commercial devs seem to have OpenGL tools from GPH...

Code:
OnExecute() gamePath=/mnt/sd/game/Propis/Propis.gpe
SDL_Exitialize()
SDL Quit...
EXIT
DGE_Font :: DGE_Font done. _[Font/DGE_Font.cpp][62]
DGE_Font :: qt4_workspace_init success. _[Font/DGE_Font.cpp][125]
DGE_Font :: CreateFont success. _[Font/DGE_Font.cpp][138]
DGE_Font :: qtype4_LoadTTF success. _[Font/DGE_Font.cpp][216]
DGE_SurfaceManager :: DGE_SurfaceManager done. _[Display/DGE_SurfaceManager.cpp]
[48]
DGE_Sound :: DGE_Sound done. _[Sound/DGE_Sound.cpp][44]
DGE_Render :: DGE_Render done. _[Display/DGE_Render.cpp][75]
DGE_Frame :: DGE_Frame done. _[Frame/DGE_Frame.cpp][54]
DGE_Display :: DGE_Display done. _[Display/DGE_Display.cpp][57]
DGE_Font :: DGE_Font done. _[Font/DGE_Font.cpp][62]
DGE_Font :: DGE_Font done. _[Font/DGE_Font.cpp][62]
DGE_Font :: DGE_Font done. _[Font/DGE_Font.cpp][62]
DGE_Font :: DGE_Font done. _[Font/DGE_Font.cpp][62]
DGE_Font :: DGE_Font done. _[Font/DGE_Font.cpp][62]
DGE_Font :: DGE_Font done. _[Font/DGE_Font.cpp][62]
DGE_Font :: DGE_Font done. _[Font/DGE_Font.cpp][62]
DGE_Font :: DGE_Font done. _[Font/DGE_Font.cpp][62]
DGE_Font :: DGE_Font done. _[Font/DGE_Font.cpp][62]
DGE_Font :: DGE_Font done. _[Font/DGE_Font.cpp][62]
DGE_Font :: DGE_Font done. _[Font/DGE_Font.cpp][62]
DGE_Font :: DGE_Font done. _[Font/DGE_Font.cpp][62]
DGE_Font :: DGE_Font done. _[Font/DGE_Font.cpp][62]
DGE_Font :: DGE_Font done. _[Font/DGE_Font.cpp][62]
DGE_Font :: DGE_Font done. _[Font/DGE_Font.cpp][62]
DGE_Font :: DGE_Font done. _[Font/DGE_Font.cpp][62]
FB_OpenMouse()
Using tslib touchscreen
HYUN_DEBUG: pollux_audio_open()
DGE_Frame ::[CreateFrame] OK. _[Frame/DGE_Frame.cpp][115]
DGE_Frame ::[SetFrameName] changed window name.[DGE Frame Work][(null)] _[Frame/
DGE_Frame.cpp][149]
DGE_Frame ::[SetFPS] changed fps.[32] _[Frame/DGE_Frame.cpp][180]
DGE_Display :: eglGetDisplay OK. _[Display/DGE_Display.cpp][257]
DGE_Display :: eglInitialize OK. _[Display/DGE_Display.cpp][270]
DGE_Display :: eglGetConfigs OK. _[Display/DGE_Display.cpp][283]
DGE_Display :: eglChooseConfig OK. _[Display/DGE_Display.cpp][296]
FBIO_GET_BOARD_NUMBER = 170
FBIO_GET_BOARD_NUMBER = 170
DISPLAY init 90
FBIO_GET_BOARD_NUMBER = 170
DGE_Display :: eglCreateWindowSurface OK. _[Display/DGE_Display.cpp][319]
DGE_Display :: eglCreateContext OK. HYUN_DEBUG: pollux_audio_open()
_[Display/DGE_Display.cpaudio_set_fragments
p][333]
DGE_Display :: eglMakeCurrent OK. _[Display/DGE_Display.cpp][346]
FBIO_GET_BOARD_NUMBER = 170
DGE_Display ::[CreateDisplay] OK. _[Display/DGE_Display.cpp][129]
DGE_SurfaceManager :: AttachDisplay OK. _[Display/DGE_SurfaceManager.cpp][103]
DGE_SurfaceManager :: AllocateSurfaceSpace OK. _[Display/DGE_SurfaceManager.cpp]
[155]
DGE_SurfaceManager :: AllocateSurfaceSpace OK. _[Display/DGE_SurfaceManager.cpp]
[173]

I uploaded the actual libraries to the archive.

http://dl.openhandhelds.org/cgi-bin/wiz.cgi?0,0,0,0,23,132
 
Unfortunately w/o source this is useless to us, plus we don't know how it performs. A 2D game sustaining 30fps is not a good enough indication.

Anyone who knows a little about OpenGL ES can rig this up themselves w/o help from GPH (ha, as if they can do anything) by continually bindnig a texture, the deeper question is doing it the "right" way so that it performs better than software. If such a thing is even possible.
 
Hello. I'm just getting started with my Wiz but I'm having problems with OpenGL.
The program crashes at the call to eglCreateContext. Below is my source code.
I'm printing a bunch of debug messages, and "4" is reached but then the output
stops. Help would be appreciated :) .

[edit] I fixed it by linking to the shared version of libwizGLES, using the static
version doesn't work because that symbol gets excluded since it's not used.


CODE
#include <GL/nanogl.h>
#include <wizGLES.h>
#include <GLES/egl.h>
#include <GLES/gl.h>
#include <cstdio>
#include <unistd.h>
#include <string>
#include <cstdarg>

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
};

static void get_ortho_matrix(float w, float h, GLfloat *m)
{
float left = 0.0f;
float right = w;
float top = 0.0f;
float bottom = h;
float neer = -1.0f;
float farr = 1.0f;

m[1+4*0] = 0.0f;
m[2+4*0] = 0.0f;
m[0+4*1] = 0.0f;
m[2+4*1] = 0.0f;
m[0+4*2] = 0.0f;
m[1+4*2] = 0.0f;
m[0+4*3] = 0.0f;
m[1+4*3] = 0.0f;
m[2+4*3] = 0.0f;

m[0+4*0] = 2.0f / (right - left);
m[1+4*1] = 2.0f / (top - bottom);
m[2+4*2] = 2.0f / (farr - neer);

m[3+4*0] = -((right+left)/(right-left));
m[3+4*1] = -((top+bottom)/(top-bottom));
m[3+4*2] = -((farr+neer)/(farr-neer));
m[3+4*3] = 1.0f;
}

void debug_message(const std::string fmt, ...)
{
va_list ap;
char msg[1000];
va_start(ap, fmt);
vsnprintf(msg, (sizeof(msg)/sizeof(*msg))-1, fmt.c_str(), ap);

FILE *f = fopen("/mnt/sd/glout.txt", "a");
if (f) {
fprintf(f, "%s", msg);
fclose(f);
}
}


int main(void)
{
EGLint numConfigs;
EGLint majorVersion;
EGLint minorVersion;

debug_message("Starting --------------------------------------\n");
nanoGL_Init();

// Create native window.
debug_message( "VID_Init: Creating the window\n" );
hNativeWnd = OS_CreateWindow();
if(!hNativeWnd)
debug_message( "VID_Init: OS_CreateWindow Failed\n" );


debug_message("1\n");

glDisplay = eglGetDisplay( (NativeDisplayType)0 );
if( glDisplay == EGL_NO_DISPLAY )
{
debug_message( "GL No Display failed\n" );
}
debug_message("2\n");

if( !eglInitialize( glDisplay, &majorVersion, &minorVersion ) )
{
debug_message( "GL Init failed\n" );
}
debug_message("3\n");
if( !eglChooseConfig( glDisplay, attrib_list, &glConfig, 1, &numConfigs ) )
{
debug_message( "GL Config failed\n" );
}
debug_message("4\n");
glContext = eglCreateContext( glDisplay, glConfig, EGL_NO_CONTEXT, NULL );
if( glContext==EGL_NO_CONTEXT )
{
debug_message( "GL Context failed\n" );
}
debug_message("5\n");
glSurface = eglCreateWindowSurface( glDisplay, glConfig, hNativeWnd, NULL );
if( glSurface==0 )
{
debug_message( "GL Surface failed\n" );
}
debug_message( "EGL Init Completed\n" );

eglMakeCurrent( glDisplay, glSurface, glSurface, glContext );

gl_vendor = (const char*)glGetString (GL_VENDOR);
debug_message("GL_VENDOR: %s\n", gl_vendor);
gl_renderer = (const char*)glGetString (GL_RENDERER);
debug_message("GL_RENDERER: %s\n", gl_renderer);

gl_version = (const char*)glGetString (GL_VERSION);
debug_message("GL_VERSION: %s\n", gl_version);
gl_extensions = (const char*)glGetString (GL_EXTENSIONS);
debug_message("GL_EXTENSIONS: %s\n", gl_extensions);

GLfloat m[16];
get_ortho_matrix(320, 240, m);
glMatrixMode(GL_PROJECTION);
glLoadMatrixf(m);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glDepthMask(GL_FALSE);

GLfloat verts[] = { 0, 0, -5, 160, 240, -5, 320, 0, -5 };
GLfloat colors[] = { 1.0, 0, 0, 0, 1.0, 0, 0, 0, 1.0 };
GLushort indices[] = { 0, 1, 2 };

glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);

glColorPointer(3, GL_FLOAT, 0, colors);
glVertexPointer(3, GL_FLOAT, 0, verts);


glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_SHORT, indices);
//glDrawArrays(GL_TRIANGLES, 0, 3);

glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);

eglSwapBuffers(glDisplay,glSurface);

usleep(1000000*3);

nanoGL_Destroy();
}
 
Back with another question. I'm currently trying to port Allegro 4.9 to the Wiz, and running into troubles creating a Pbuffer. If anyone has done this successfully I would like to hear how. I will attach my code and explain how things work (or don't work). This function is supposed to create a pbuffer surface inside ogl_bitmap. Where does it fail? Well first let me say what works. eglChooseConfigs works, I get a return value of TRUE and numConfigs contains the number 2, meaning there are two configurations that support the type of pbuffer I want. Now I try each of those configs 1 at a time and try to create a pbuffer with it. This is where it fails, and gets weird. The return value from eglCreatePbufferSurface is always 0 (or NULL). However, eglGetError returns EGL_SUCCESS. So it's kind of a mixed signal, that I'm not sure what it means. I've tried other options (When I use any options but EGL_WIDTH, EGL_HEIGHT, and EGL_LARGEST_PBUFFER, I get the error code EGL_BAD_ATTRIBUTE), nothing seems to work. Does this means pbuffers are not supported on the Wiz? I'm using the latest GPH libopengles_lite.so. If they are not supported, is there anything else I can use to do fast render-to-texture? Any help at all on this would be nice... I'm kind of stuck.

Code:
void _al_egl_create_pbuffer(ALLEGRO_BITMAP_OGL *ogl_bitmap)
{
   ALLEGRO_DISPLAY_GP2XWIZ *wiz_disp = (ALLEGRO_DISPLAY_GP2XWIZ *)ogl_bitmap->bitmap.display;

   EGLint attrib_list[] =
   {
     EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
     EGL_RED_SIZE, 5,
     EGL_GREEN_SIZE, 6,
     EGL_BLUE_SIZE, 5,
     EGL_NONE
   };

   EGLConfig cfg[10];
   EGLint numConfigs = 0;

   EGLBoolean ret = eglChooseConfig(wiz_disp->egl_display, attrib_list, cfg, 10, &numConfigs);
   if (!ret) {
      ALLEGRO_INFO("eglChooseConfig failed with error %d\n", eglGetError());
   }

   ALLEGRO_INFO("numConfigs=%d\n", numConfigs);

   int size;

   if (ogl_bitmap->true_w > ogl_bitmap->true_h)
      size = ogl_bitmap->true_w;
   else
      size = ogl_bitmap->true_h;

   EGLint attr_list[] = {
      EGL_WIDTH, size,
      EGL_HEIGHT, size,
      EGL_NONE
   };

   ALLEGRO_INFO("Attempting to create %dx%d pbuffer\n", size, size);

   int i;
   for (i = 0 ; i < numConfigs; i++) {
      ogl_bitmap->pbuffer = eglCreatePbufferSurface(wiz_disp->egl_display,
         cfg[i], attr_list);
      if (ogl_bitmap->pbuffer != EGL_NO_SURFACE)
         break;
      else {
         ALLEGRO_DEBUG("Creating pbuffer with config %d failed (%d)\n", i, eglGetError());
      }
   }
   
   if (i == numConfigs) {
      ALLEGRO_DEBUG("Couldn't create pbuffer.\n");
      ogl_bitmap->pbuffer = 0;
      return;
   }

   ALLEGRO_INFO("Created pbuffer (%p)\n", ogl_bitmap->pbuffer);

   ogl_bitmap->context = eglCreateContext(wiz_disp->egl_display, cfg[i], wiz_disp->egl_context, NULL);
   if (ogl_bitmap->context == EGL_NO_CONTEXT) {
      ALLEGRO_DEBUG("Creating context for pbuffer failed (%d)\n", eglGetError());
   }

   EGLSurface old_read = eglGetCurrentSurface(EGL_READ);
   EGLSurface old_draw = eglGetCurrentSurface(EGL_DRAW);
   EGLContext old_ctxt = eglGetCurrentContext();

   ret = eglMakeCurrent(wiz_disp->egl_display, ogl_bitmap->pbuffer,
      ogl_bitmap->pbuffer, ogl_bitmap->context);
   if (!ret) {
      ALLEGRO_DEBUG("eglMakeCurrent failed with error %d\n", eglGetError());
   }

   al_draw_bitmap(&ogl_bitmap->bitmap, 0, 0, 0);
         
   eglMakeCurrent(wiz_disp->egl_display, old_read, old_draw,
      old_ctxt);
}
 
P buffer? I don't code so I am not sure what that is in code.

I always thought that was another name for a toilet.

(sorry)
 
satacoy said:
In the first post of this thread, you mention that you can find port.cpp in the opengl es demo archive. However, the file in the archive (http://dl.openhandhelds.org/cgi-bin/wiz.cgi?0,1,0,0,23,53) doesn't appear to have any source in it. Is there another place to look for this?

The file can be found here.

Thanks to Orkie.

Regards,
Stephan
 
Last edited by a moderator:
Does anybody got workaround for following error :

./gl: symbol lookup error: /usr/local/lib/libopengles_lite.so: undefined symbol: GLESOAL_Initalize
 
yoku said:
Does anybody got workaround for following error :

./gl: symbol lookup error: /usr/local/lib/libopengles_lite.so: undefined symbol: GLESOAL_Initalize

that is defined in port.cpp or in wizlib.so if your using my prebuilt version.
 
Last edited by a moderator:
Pickle said:
yoku said:
Does anybody got workaround for following error :

./gl: symbol lookup error: /usr/local/lib/libopengles_lite.so: undefined symbol: GLESOAL_Initalize

that is defined in port.cpp or in wizlib.so if your using my prebuilt version.

Even with port.cpp I am getting same error while executing the compiled program.
arm-openwiz-linux-gnu-gcc main.c port.cpp -lnanoGL -ldl -o gl -I./lf1000/
 
Last edited by a moderator:
Unused symbols get dropped so make a shared library. This is how I worked around it.

So nobody has tried to get pbuffers to work on the Wiz? :(
 
trentg said:
Unused symbols get dropped so make a shared library. This is how I worked around it.

hey trentg, making shared lib that worked, but now I am getting following error,
./gl: symbol lookup error: /usr/local/lib/libopengles_lite.so: undefined symbol: _Z27GLESOAL_GetDisplayDirectionv

Do I need to write a dummy function for GLESOAL_GetDisplayDirectionv in port.cpp ?
can u share function prototype for GLESOAL_GetDisplayDirectionv
 
Last edited by a moderator:
Back
Top