PDA

View Full Version : .NET CF OpenGLES on Windows Mobile



bpredic
04-05-2011, 05:49 AM
I am fairly new to OpenGLES on managed Windows Mobile so please forgive me for any lame questions.

In my .NET Compact Framework application I have some OpenGL ES drawing. I am using OpenGL ES wrapper by http://www.koushikdutta.com/2008/08/net ... r-for.html (http://www.koushikdutta.com/2008/08/net-compact-framework-wrapper-for.html). I am testing my applicaiton on HTC Touch HD (Blackstone). Everything works as expected when rendering on window (some Panel subclass). Since I have some additional drawing with GDI+ after OpenGLES rendering I wish to eliminate flicker by double buffering. OpenGLES is to render to backbuffer (pixmap surface), after that use GDI+ for some additional drawing on backbuffer and finaly draw backbuffer on screen.
I presumed I need to create pixmapsurface based on nativepixmap for backuffer OpenGLES rendering, but I have problems choosing configuration with EGL_PIXMAP_BIT set. I have iterated through all configs (20 of them) and there are indeed some of them with EGL_PIXMAP_BIT.

Here is my init code:


EGLConfig[] configs = new EGLConfig[50];
int numConfig;
int value = 0;
bool retVal = egl.GetConfigs(myDisplay, configs, 50, out numConfig);

Returns 20 configs.


Bitmap bmp = new Bitmap(256,256);
int error = 0;
for(int i=0 ; i<numConfig ; i++)
{
egl.GetConfigAttrib(myDisplay, configs[i], egl.EGL_SURFACE_TYPE, out value);
if (value == egl.EGL_PIXMAP_BIT)
{

Finds several surfaces with EGL_PIXMAP_BIT set.


mySurface = egl.CreatePixmapSurface(myDisplay, configs[i], new EGLNativePixmapType(bmp.GetHbitmap()), null);

Generates Not Supported Exception


error = egl.GetError();
}
}
int[] attribList = new int[]
{
egl.EGL_RED_SIZE, 5,
egl.EGL_GREEN_SIZE, 6,
egl.EGL_BLUE_SIZE, 5,
egl.EGL_DEPTH_SIZE, 0 ,
egl.EGL_SURFACE_TYPE, egl.EGL_PIXMAP_BIT,
egl.EGL_STENCIL_SIZE, egl.EGL_DONT_CARE,
egl.EGL_NONE, egl.EGL_NONE
};



retVal = egl.ChooseConfig(myDisplay, attribList, configs, configs.Length, out numConfig);

Strangely returns 0 confirs in numConfig.


if (!retVal || numConfig < 1)
error = egl.GetError();

error is 12288, EGL_SUCCESS?


error = egl.GetError();

EGLConfig config = configs[0];