Create an OpenGL ES 2.0 context on a “standard” Linux system

纵饮孤独 提交于 2019-12-11 04:40:38

问题


I'm writing a game engine using opengl 3.3/SDL/glew/Linux (Ubuntu 11.04). I want to keep the possibility to deploy on mobile (OpenGL ES 2). This means that I have to stay somewhat OpenGL ES 2.0 compatible. Therefore my question is: Is it possible to create an OpenGL ES 2.0 context using SDL/(existing patch on SDL).


回答1:


You don't need a GL ES 2.0 context on PC, you can use OpenGL 4.1, which has the GL_ARB_es2_compatibility, which adds the OpenGL ES functions that weren't in OpenGL, making them API compatible.




回答2:


Instead of using a nonofficial/patched version of SDL 1.2 you could simply use SDL 1.3.

Quoting myself on another question:

I suggest you download and setup the Khronos OpenGL ES 2.0 SDKs for POWERVR SGX PC Emulation package (Unfortunately you have to register to be able to download). This allows you to get everything up and running on a desktop computer which will make your life a lot easier when it comes to debugging. You can then use C/C++ to develop your OpenGL ES 2.0 applications.

If I'm not mistaken my Android phone (Samsung Galaxy S) also uses this OpenGL implementation.

Instead of using the Khronos SDK you could also use the OpenGL ES 2.0 libraries from the Mesa3D Project (Ubuntu has them in the repository). They work fine but I can't recommend them because I already ran into a situation where the results differed from the Khronos SDK implementation and my Android device.

EDIT: You also have to create a Window and an OpenGL rendering context in order to actually use OpenGL. For that I can recommend SDL (1.3) which also has an official port for Android. I tested it on Android and Ubuntu with the mentioned SDK. It allows me to use the same code for both.




回答3:


Rather than the PowerVR SDK that requires a registration, you can use the ARM Mali equivalent that is an open download. Here it is: http://www.malideveloper.com/opengl-es-20-emulator.php. They can run on a Mesa software path if you don't have OpenGL 2.0 hardware underneath.



来源:https://stackoverflow.com/questions/5976067/create-an-opengl-es-2-0-context-on-a-standard-linux-system

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!