Wrong Colors
Correct Colors
To get the full benefits of developing in VS I not only want to be able to compile, but also run my game. To do that I need to be able to render using Open GL ES 1.1. The problem is that this is a version of OpenGL that is for mobile devices. Fortunately, there are a few emulators available for the PC.
After some web searching I found an emulator by from Mali, but when I tried to use it I kept getting this error:
[Error] Failed to create EGL window surface, error 12293
. I did a lot of searching and investigation to fix it, but was never able to. I did see one person describe that they were successful, but their suggestions weren't working for me, so I eventually gave up and tried to find another emulator.Next I found this one from Khronos. It still had a few minor issues, but when I followed the steps described in this thread I got it to work. The thread said that they also managed to get the Mali emulator working, and I don't know why it didn't work for me.
One interesting thing I found with this emulator was that it isn't 100% compatible with the OpenGL ES 1.1 that runs on the iPhone. Specifically the
internalFormat
argument passed to GL.TexImage2D
seems different. In my original iPhone version I passed All.Rgba
for this, but when I ran this on the PC my textures' colors were strange. After a lot of investigation I finally discovered that changing this to All.Bgra
fixes the problem. I currently have a hack to set this depending on the OS.bool isWindows = System.Environment.OSVersion.Platform == PlatformID.Win32NT;All format = isWindows ? All.Bgra : All.Rgba;GL.TexImage2D(All.Texture2D, 0, (int)format, width, height, 0, format, All.UnsignedByte, textureData);
I'm not enough of a OpenGL expert to know which is actually correct. It will also be interesting to see how other platforms like Android and Windows Mobile 7 handle this. For now I'm just pretty happy that this was the only platform-dependent adjustment I've had to make.
Next time: OpenAL on Windows.
No comments:
Post a Comment