IOS and Opengl ES 2

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
kramjones4
Posts: 2
Joined: Wed Aug 03, 2011 5:35 pm

IOS and Opengl ES 2

Post by kramjones4 »

Hi all,
I have my project running under ios/irrlicht/opengl es 1 without any trouble and it s great. Now I need some shader stuff so I want to use opengl ES2,
I m using the CIrrDeviceIPhone device,I have changed in the IrrCompileConfig in order to comment

Code: Select all

//#define _IRR_COMPILE_WITH_OPENGL_
//#define _IRR_COMPILE_WITH_OGLES1_
and uncommented :

Code: Select all

#define _IRR_COMPILE_WITH_OGLES2_
I have a trouble on XCode like :

"_eglCreateWindowSurface", referenced from:
irr::video::COGLES2Driver::COGLES2Driver(irr::SIrrlichtCreationParameters const&, irr::video::SExposedVideoData const&, irr::io::IFileSystem*, MIrrIPhoneDevice const&)in libIrrlicht_lib.a(COGLES2Driver.o)


Im not a xcode user, so I m little lost. Seems that the project cant link with the egl lib, but I dont understand why when using es1, there is no problem.

Someone can help me ?
Does someone use ogles2 driver on ios without any trouble ?

Thanks a lot

Have a nice day

Km.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: IOS and Opengl ES 2

Post by hybrid »

I don't think that the current driver is ready for iOS. There are so many special things in the ogl-es1 driver for iOS (which are otherwise totally useless and hence outcommented). Though the above problem for now is only a linker problem, maybe you just need to add the ogl-es2 libs to the project.
kramjones4
Posts: 2
Joined: Wed Aug 03, 2011 5:35 pm

Re: IOS and Opengl ES 2

Post by kramjones4 »

Thanks for your response.
How I do that ? Where I can find these ogl2-lib for ios ?
I dont understand how ogles1 libs are linked to the project, it seems that having the OpenglESFramework in the project make irrlicht linked with ogles1 lib, but that does not work for ogles2, I dont know why.
Any clue ?

Thanks
rus_artur
Posts: 1
Joined: Mon May 30, 2011 5:26 am
Location: timisoara

Re: IOS and Opengl ES 2

Post by rus_artur »

Hi kramjones2 ,have you solved that issue .

For openGL ES 1 it seems the egl functions are not used , there is a directive to avoid compiling that code.
Also it seems the egl cannot be called directly in iOS like on Android , you have to use eagl api .

Anyway, is anyone that has compiled and linked the irrlicht openGL ES 2.0 for iphone ?

Maybe hybrid has better news :) .
My name is Artur
flynks
Posts: 3
Joined: Wed Oct 24, 2012 12:00 pm

Re: IOS and Opengl ES 2

Post by flynks »

Hi,

It seems this thread have no answer also. :(
Does anyone tried this app on the ipad -> "http://apps.swaprose.com/ios/slingball3d/"? It says that it was build using irrlicht and bullet physics. It looks promising but don't know if it builds from irrlicht or an es 2 build. I would like to try this but I don't have an iPad. :(

If there's anyone that have a working build of es 2 for ios, if you can help we gladly appreciate it. Thanks.
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: IOS and Opengl ES 2

Post by Nadro »

Support for OGL ES2 under iOS already exist in current ogl-es branch. I use this revision (+patch for compressed pvr textures) in my iOS game. But remember that built-in fixed pipeline shader is bugged, thats why You will see everything white (exclude background-frame color). If You will use a custom shaders in Your game this bug will be not problematic for You. I checked current code under both iPhone/iPad simulator and iPod 4 touch device (on iPod I only checked OGL ES1) and it works fine. In last time we really improved iOS support in Irrlicht. If You will have some more questions or problems just ask, I'll try help :)
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
flynks
Posts: 3
Joined: Wed Oct 24, 2012 12:00 pm

Re: IOS and Opengl ES 2

Post by flynks »

Hello,

Thanks for this hint nadro. This will help for our debugging.

Thanks again.
codetiger
Posts: 103
Joined: Wed May 02, 2012 9:24 am
Location: Chennai, India
Contact:

Re: IOS and Opengl ES 2

Post by codetiger »

Sorry for bringing this post up again.

Nadro, can we use shader callback and addHighLevelShaderMaterialFromFiles, to use shaders in iOS? OR we have to completely re-work on built-in shaders?

Can you explain a bit what changes we need to run oepngles 2 on ios.
IrrNaCl - Irrlicht Port for Google Chrome Native Client - Demo

Iyan 3D - Make your own 3d animation using your iOS Device
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: IOS and Opengl ES 2

Post by Nadro »

Hi,
You can use shaders for OGL ES2 in the same way as for OGL on PC. So shader callback, addHighLevelShaderMaterialFromFiles etc will be works fine. If you don't need built-in Irrlicht materials you don't have to prebuilt it, because you will be use your own custom materials. You have to add just one+ more custom material(s) for rendering a scene.
Cheers,
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
codetiger
Posts: 103
Joined: Wed May 02, 2012 9:24 am
Location: Chennai, India
Contact:

Re: IOS and Opengl ES 2

Post by codetiger »

Thanks for your quick response.

Am bit new to Irrlicht Architecture, and confused how to set the attributes like vertexnormals, vertexpositions and others if I use custom shaders.
IrrNaCl - Irrlicht Port for Google Chrome Native Client - Demo

Iyan 3D - Make your own 3d animation using your iOS Device
codetiger
Posts: 103
Joined: Wed May 02, 2012 9:24 am
Location: Chennai, India
Contact:

Re: IOS and Opengl ES 2

Post by codetiger »

I tried removing everything in the built-in shaders and only see black screen in the latest opengles branch. I am trying to run a simple example on iPad 1.1. ES1.1 works perfect, but es2.0 just shows black screen. I guess there is some driver issue. Can you confirm on this plz.
IrrNaCl - Irrlicht Port for Google Chrome Native Client - Demo

Iyan 3D - Make your own 3d animation using your iOS Device
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: IOS and Opengl ES 2

Post by Nadro »

You can set these attributes like in a standard OpenGL GLSL lang (fixed pipeline sementic). You see a black screen because an OGL ES2 driver is shader based, so currently You don't have available any material (You removed built-in materials).
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
beof
Posts: 8
Joined: Thu Nov 22, 2012 9:40 am

Re: IOS and Opengl ES 2

Post by beof »

Hello, Nadro,
I have checked out the latest irrlicht/branches/ogl-es, and I select Opengl ES 2 driver during my iPhone4 application. I tried to load a image texture and draw2DImage, however, the non power of 2 image is displayed only black.
The console prints out the following error message:
Unable to find uniform: uLightSpecular
Unable to find uniform:uLightDirection

It seems that there is bug COGLES2LMaterialRenderer.cpp.

Is there a workable build of opengles 2 on ios? And what changes do I need to fix the problem?
Your help would be greatly appreciated.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: IOS and Opengl ES 2

Post by hybrid »

You don't need those uniforms. Rendering does not happen due to other problems in your case. Not sure, though, which ones. Do you have a start log for your app?
beof
Posts: 8
Joined: Thu Nov 22, 2012 9:40 am

Re: IOS and Opengl ES 2

Post by beof »

Thanks for your reply.
After test, I found that Rendering 2-D npot image is due to other problems as you predicted.
However, when I tried to test the example-01, the color of the texture is black, which is apparently wrong.

And the log shows:

Irrlicht Engine version 1.8.0-alpha
Darwin 13.0.0 Darwin Kernel Version 13.0.0: Wed Oct 10 23:29:02 PDT 2012; root:xnu-2107.2.34~2/RELEASE_ARM_S5L8930X iPhone3,1
Using renderer: OpenGL ES 2.0 IMGSGX535-73.16
Imagination Technologies
GL_OES_depth_texture GL_OES_depth24 GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_mapbuffer GL_OES_packed_depth_stencil GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_texture_float GL_OES_texture_half_float GL_OES_vertex_array_object GL_EXT_blend_minmax GL_EXT_debug_label GL_EXT_debug_marker GL_EXT_discard_framebuffer GL_EXT_map_buffer_range GL_EXT_read_format_bgra GL_EXT_separate_shader_objects GL_EXT_shader_framebuffer_fetch GL_EXT_shader_texture_lod GL_EXT_texture_filter_anisotropic GL_EXT_texture_storage GL_APPLE_copy_texture_levels GL_APPLE_framebuffer_multisample GL_APPLE_rgb_422 GL_APPLE_sync GL_APPLE_texture_format_BGRA8888 GL_APPLE_texture_max_level GL_IMG_read_format GL_IMG_texture_compression_pvrtc
Loading shader: COGLES2FixedPipeline.vsh
Loading shader: COGLES2FixedPipeline.fsh
Unable to find uniform : uLightSpecular
Unable to find uniform : uLightDirection
Unable to find uniform : uLightExponent
Unable to find uniform : uLightCutoff
Loading shader: COGLES2Renderer2D.vsh
Loading shader: COGLES2Renderer2D.fsh
Loading shader: COGLES2NormalMap.vsh
Loading shader: COGLES2NormalMap.fsh
Loading shader: COGLES2ParallaxMap.vsh
Loading shader: COGLES2ParallaxMap.fsh
Unable to find uniform : uLightDiffuse
Loaded mesh: sydney.md2
Loaded texture: /private/var/mobile/Applications/50A56ED9-FCD4-4B98-83FB-428E9984CE48/TestIrrlichtEngine.app/sydney.bmp

Does the shader program needs to change as the above description?
Thank you.
Post Reply