OpenGLES 1.1 Driver Porting Issues

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!
seongnam
Posts: 28
Joined: Mon Feb 23, 2009 5:53 am

OpenGLES 1.1 Driver Porting Issues

Post by seongnam »

Hi;

While I was trying to migrate OpenGLES driver, which was developed in 1.4 version, on 1.5 version, I found 2 issue points.

I have been interested with OpenGL or OpenGLES, actually 3D technologies, but this is the first time for deep diving for real code beyond example code, but still I need to improve more skills.

Anyway, I hope somebody can give me some idea to solve this issues.

1. PixelFormat
Original OpenGL Driver uses BGR or BGRA order to handle pixel format, but OpenGLES doesn't support those, and the relative codes are changed with RGB order. everything are fine except colour flipping between Blue and Red.

so, anybody recommends me to modify some place to fix this problem ?

//! copies the the texture into an open gl texture.

void COpenGLESTexture::copyTexture(bool newTexture)

{

if (!Image)

{

Printer::log("No image for OpenGL texture to upload", ELL_ERROR);

return;

}



switch (ColorFormat)

{

case ECF_A1R5G5B5:

InternalFormat=GL_RGBA;

PixelFormat=GL_RGBA;//GL_BGRA_EXT

PixelType=GL_UNSIGNED_SHORT_5_5_5_1;//GL_UNSIGNED_SHORT_1_5_5_5_REV

break;

case ECF_R5G6B5:

InternalFormat=GL_RGB;

PixelFormat=GL_RGB;//GL_BGR

PixelType=GL_UNSIGNED_SHORT_5_6_5;//GL_UNSIGNED_SHORT_5_6_5_REV

break;

case ECF_R8G8B8:

InternalFormat=GL_RGB;

PixelFormat=GL_RGB;//GL_BGR

PixelType=GL_UNSIGNED_BYTE;

break;

case ECF_A8R8G8B8:

InternalFormat=GL_RGBA;

PixelFormat=GL_RGBA;//GL_BGRA_EXT

PixelType=GL_UNSIGNED_BYTE;//GL_UNSIGNED_INT_8_8_8_8_REV

break;

default:

Printer::log("Unsupported texture format", ELL_ERROR);

break;

}


2. GUI is not coming out
Seems like, "05.UserInterface" application is working well internally when I track the OpenGLES driver, but I can't see any widgets except background colour on screen.
so, currently 2D GUI and 2D graphic logo aren't on screen even though lots of functions are called between beginScene(...) & endScene(...).

I just attached part of my log file to check function call sequence.

OGLESPCViewer Version 2, 15/04/05

OpenGL ES desktop PC emulation viewer for MBX IP cores
Copyright Imagination Technologies Ltd 2004-2005.

Reading oglespcviewer.cfg file...
Using profile: PowerVR MBX1 With VGP - GENERIC PROFILE
Please select the driver you want for this example:
(c) OpenGL 1.5
(e) OpenGL|ES 1.1
(f) NullDevice
(otherKey) exit

Irrlicht Engine version 1.5
Linux 2.6.27.9-159.fc10.i686 #1 SMP Tue Dec 16 15:12:04 EST 2008 i686
Creating X window...
Visual chosen: : 33
COpenGLESDriver.cpp:COpenGLESDriver:36
Error: eglChooseConfig, no matched config.

EGL: Using config #1
ScreenSize of renderer: 640, 480
COpenGLESDriver.cpp:genericDriverInit:198
COpenGLESDriver.cpp:getName:1839
Using renderer: OpenGL|ES 1.1
PowerVR MBX1 With VGP - GENERIC PROFILE: Imagination Technologies
OpenGL|ES driver version is 1.2 or better.
Failed to load OpenGL|ES's multitexture extension, proceeding without.
GLSL not available.
COpenGLESDriver.cpp:setAmbientLight:1960
COpenGLESDriver.cpp:createMaterialRenderers:297
COpenGLESDriver.cpp:setRenderStates3DMode:1415
COpenGLESDriver.cpp:createGLMatrix:1318
COpenGLESDriver.cpp:disableTextures:1307
COpenGLESDriver.cpp:setTexture:1268
COpenGLESDriver.cpp:setBasicRenderStates:1547
COpenGLESDriver.cpp:setWrapMode:1462
COpenGLESDriver.cpp:setFog:2280
COpenGLESDriver.cpp:createDeviceDependentTexture:1352
Image Color Format: 0, Color Format: 3
COpenGLESDriver.cpp:testGLError:1376
COpenGLESDriver.cpp:testGLError:1376
COpenGLESDriver.cpp:createDeviceDependentTexture:1352
Image Color Format: 3, Color Format: 3
COpenGLESDriver.cpp:testGLError:1376
COpenGLESDriver.cpp:testGLError:1376
COpenGLESDriver.cpp:createDeviceDependentTexture:1352
Image Color Format: 3, Color Format: 3
COpenGLESDriver.cpp:testGLError:1376
COpenGLESDriver.cpp:testGLError:1376
Loaded texture: /root/irrlicht-1.5-2009-02-21/media/irrlichtlogo2.png
COpenGLESDriver.cpp:beginScene:361
COpenGLESDriver.cpp:draw2DRectangle:1085
COpenGLESDriver.cpp:disableTextures:1307
COpenGLESDriver.cpp:setTexture:1268
COpenGLESDriver.cpp:setRenderStates2DMode:1739

COpenGLESDriver.cpp:endScene:350


Regards;
SeongNam.
________
KLONOPIN REHAB FORUMS
Last edited by seongnam on Fri Feb 25, 2011 9:40 am, edited 3 times in total.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

We already have the OpenGL-ES 1.x driver fully functional in an SVN branch: branches/ogl-es
It's already ported to 1.5 and has many more features supported, compared to the original 1.4 code version. However, we still only support platforms with BRGA8888 extension supported. Fortunately, this includes iPhone and several other platforms using the PowerVR chips. A better version is still in development, and will probably take much more time, as it requires fundamental changes in the color handling of Irrlicht.
Don't know about your GUI problems, but our new driver should be able to render 2D without problems.
seongnam
Posts: 28
Joined: Mon Feb 23, 2009 5:53 am

Post by seongnam »

I have tried to check your driver, and it is better then mine for colour control... so I will look at more to understand how you handle that...
but still GUI is not showing... for example, when I run 06.2DGraphics example, I got below messages.
my system environment: Fedora Linux 10, PowerVR OGLES 1.1 emulator, library OGLES_CM. gcc version 4.3.2 20081105 (Red Hat 4.3.2-7) (GCC)

Code: Select all

[root@snoopy Linux]# ./06.2DGraphics 
OGLESPCViewer Version 2, 15/04/05

OpenGL ES desktop PC emulation viewer for MBX IP cores
Copyright Imagination Technologies Ltd 2004-2005.

Reading oglespcviewer.cfg file...
Using profile: PowerVR MBX1 With VGP - GENERIC PROFILE
Please select the driver you want for this example:
 (a) Direct3D 9.0c
 (b) Direct3D 8.1
 (c) OpenGLES 1.1
 (d) Software Renderer
 (e) Burning's Software Renderer
 (f) NullDevice
 (otherKey) exit

c
Irrlicht Engine version 1.5
Linux 2.6.27.7-134.fc10.i686 #1 SMP Mon Dec 1 22:42:50 EST 2008 i686
Creating X window...
Using plain X visual
Visual chosen: : 33
Using renderer: OpenGL ES-CM 1.1
OpenGL_ES
Imagination Technologies
EGL_IMG_power_management 
GL_OES_byte_coordinates GL_OES_compressed_paletted_texture GL_OES_fixed_point GL_OES_point_size_array GL_OES_point_sprite GL_IMG_user_clip_planes GL_OES_matrix_palette GL_OES_draw_texture GL_OES_read_format GL_OES_single_precision GL_IMG_texture_compression_pvrtc GL_IMG_texture_env_enhanced_fixed_function GL_ARB_texture_env_combine GL_ARB_texture_env_dot3 GL_OES_matrix_get GL_IMG_vertex_program GL_IMG_read_format  GL_IMG_texture_format_BGRA8888  GL_EXT_multi_draw_arrays 
GL_INVALID_ENUM
Could not bind Texture
Loaded texture: /home/seongnam/irrlicht-ogl-es/media/2ddemo.bmp
GL_INVALID_VALUE
Could not glTexImage2D
GL_INVALID_VALUE
Could not glTexImage2D
________
DEMEROL REHAB DICUSSION
Last edited by seongnam on Fri Feb 25, 2011 9:40 am, edited 1 time in total.
seongnam
Posts: 28
Joined: Mon Feb 23, 2009 5:53 am

Post by seongnam »

11.PerPixelLighting is not working; the globe is not affected with the lighting... but, it worked well for the previous version.
________
Uhwh
Last edited by seongnam on Fri Feb 25, 2011 9:40 am, edited 1 time in total.
grafikrobot
Posts: 44
Joined: Wed Dec 26, 2007 11:42 pm

Post by grafikrobot »

seongnam wrote:11.PerPixelLighting is not working; the globe is not affected with the lighting... but, it worked well for the previous version.
Implementing the normal map materials is on my todo list, if that's what you are referring to.
seongnam
Posts: 28
Joined: Mon Feb 23, 2009 5:53 am

Post by seongnam »

I don't think that is normal map issue.
It seems like just lighting problem... because I expect shadow when the two light objects is on( actually, the light object which is going around big globe) which should make shadow & light effect on the surface of centre object.
________
Alaska Medical Marijuana Dispensaries
Last edited by seongnam on Fri Feb 25, 2011 9:41 am, edited 2 times in total.
seongnam
Posts: 28
Joined: Mon Feb 23, 2009 5:53 am

do you use "GL_OES_framebuffer_object" ext

Post by seongnam »

hybrid told me the GUI should work, but my system doesn't...
so, I am trying to figure out the difference between your system and my system... and I realized that my system doesn't support the extension.
I am not sure that the extension is core extension or optional... but if that is core extension... I need to change the emulator first... but if not, this driver need to support the case as well.

Code: Select all

GL_OES_byte_coordinates GL_OES_compressed_paletted_texture GL_OES_fixed_point GL_OES_point_size_array GL_OES_point_sprite GL_IMG_user_clip_planes GL_OES_matrix_palette GL_OES_draw_texture GL_OES_read_format GL_OES_single_precision GL_IMG_texture_compression_pvrtc GL_IMG_texture_env_enhanced_fixed_function GL_ARB_texture_env_combine GL_ARB_texture_env_dot3 GL_OES_matrix_get GL_IMG_vertex_program GL_IMG_read_format  GL_IMG_texture_format_BGRA8888  GL_EXT_multi_draw_arrays
GL_INVALID_ENUM
Could not bind Texture
Loaded texture: /home/seongnam/irrlicht-ogl-es/media/2ddemo.bmp
GL_INVALID_VALUE
Could not glTexImage2D
GL_INVALID_VALUE
Could not glTexImage2D
As you can see the error message, it has a binding problem and I assume that is the texture binding to frame buffer object....
am I correct ?
________
HOMEMADE VAPORIZERS
Last edited by seongnam on Fri Feb 25, 2011 9:41 am, edited 1 time in total.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Could be a problem with 16bit devices. Try to force 32bit on device and textures.
seongnam
Posts: 28
Joined: Mon Feb 23, 2009 5:53 am

Post by seongnam »

I have found a solution in your code for my colour issue because OGLES has BGRA8888 extension... that is OK.
but still, I am not clear for 32 bit enforcement; I had already done with G:8,B8,B:8,A8 configuration for EGL config... are you saying this changes ?

Code: Select all

#else
	EGLint attribs[] =

	{

		EGL_RED_SIZE, 8,

		EGL_GREEN_SIZE, 8,

		EGL_BLUE_SIZE, 8,

		EGL_ALPHA_SIZE, 8,

		EGL_BUFFER_SIZE, 16,

		EGL_SURFACE_TYPE, EGL_WINDOW_BIT,

//		EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER,

		EGL_DEPTH_SIZE, 16,

		EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT,

		EGL_NONE, 0

	};

#endif
	EGLConfig config;

	EGLint num_configs;

	if (!eglChooseConfig(EglDisplay, attribs, &config, 1, &num_configs))

but, the result is same...
if you are not saying the treatment, please indicate the source code what I have to change....
________
Extreme vaporizer
Last edited by seongnam on Fri Feb 25, 2011 9:41 am, edited 1 time in total.
seongnam
Posts: 28
Joined: Mon Feb 23, 2009 5:53 am

Post by seongnam »

within the OpenGLES construction code, below code should be added to handle shadow.

StencilBuffer = params.Stencilbuffer;
________
TEEN VIDS
Last edited by seongnam on Fri Feb 25, 2011 9:41 am, edited 1 time in total.
seongnam
Posts: 28
Joined: Mon Feb 23, 2009 5:53 am

Pixel lighting

Post by seongnam »

LastSetLight parameter should be updated as below to handle dynamic light control.

Code: Select all

//! deletes all dynamic lights there are

void COGLES1Driver::deleteAllDynamicLights()

{

	for (s32 i=0; i<LastSetLight+1; ++i)

		glDisable(GL_LIGHT0 + i);



	RequestedLights.clear();

	LastSetLight = -1;


	CNullDriver::deleteAllDynamicLights();

}





//! adds a dynamic light

s32 COGLES1Driver::addDynamicLight(const SLight& light)

{

	if (LastSetLight == MaxLights-1)
		return -1;

	CNullDriver::addDynamicLight(light);



	RequestedLights.push_back(RequestedLight(light));



	u32 newLightIndex = RequestedLights.size() - 1;



	// Try and assign a hardware light just now, but don't worry if I can't

	assignHardwareLight(newLightIndex);


	++LastSetLight;


	return (s32)newLightIndex;

}

________
Nsr125
Last edited by seongnam on Fri Feb 25, 2011 9:41 am, edited 1 time in total.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Stencil will be fixed in the next commit, the lights handling seems to be different now, but I couldn't figure out the proper way to check for a properly assigned light. This is a general issue, though, so it will be fixed in SVN/trunk if anything needs to be fixed.
seongnam
Posts: 28
Joined: Mon Feb 23, 2009 5:53 am

Post by seongnam »

This is a following question for the No GUI issue in my system.
I am not clear why I can't get the texture handle with calling "glGenTextures(1, &TextureName);" in the constructor for GUI, but it is always success for the 3D objects.
Before real texture mapping whatever the system support frame buffer object extension or not, the operation is pre-processing to get texture handle and it should not have any system dependency...so, ideally, it should work... but... my system is not...

Code: Select all

//! constructor for usual textures

COGLES1Texture::COGLES1Texture(IImage* origImage, const char* name, COGLES1Driver* driver)

	: ITexture(name), Driver(driver), Image(0),

	TextureName(0), InternalFormat(GL_RGBA), PixelFormat(GL_RGBA),

	// TODO ogl-es

	// PixelFormat(GL_BGRA),

	PixelType(GL_UNSIGNED_BYTE),

	HasMipMaps(true), IsRenderTarget(false), AutomaticMipmapUpdate(false),

	UseStencil(false), ReadOnlyLock(false)

{

	#ifdef _DEBUG

	setDebugName("COGLES1Texture");

	#endif



	HasMipMaps = Driver->getTextureCreationFlag(ETCF_CREATE_MIP_MAPS);

	getImageData(origImage);



	if (Image)

	{

		printf("DBG:%s:%d\n",__FUNCTION__,__LINE__);


		glGenTextures(1, &TextureName);
		if (Driver->testGLError())

			Printer::log("Could not generate Texture", ELL_ERROR);
		else
			Printer::log("Success to generate Texture", ELL_ERROR);



		printf("DBG:%s:%d\n",__FUNCTION__,__LINE__);

		copyTexture();

	}

}

this is the results.

Code: Select all

[root@snoopy bin]# ./01.HelloWorld 
OGLESPCViewer Version 2, 15/04/05

OpenGL ES desktop PC emulation viewer for MBX IP cores
Copyright Imagination Technologies Ltd 2004-2005.

Reading oglespcviewer.cfg file...
Using profile: PowerVR MBX1 With VGP - GENERIC PROFILE
Please select the driver you want for this example:
 (a) Direct3D 9.0c
 (b) Direct3D 8.1
 (c) OpenGL 1.5
 (d) OpenGL-ES1
 (e) Software Renderer
 (f) Burning's Software Renderer
 (g) NullDevice
 (otherKey) exit

d
Irrlicht Engine version 1.5
Linux 2.6.27.9-159.fc10.i686 #1 SMP Tue Dec 16 15:12:04 EST 2008 i686
Creating X window...
Using plain X visual
Visual chosen: : 33
Using renderer: OpenGL ES-CM 1.1
OpenGL_ES
Imagination Technologies
EGL_IMG_power_management 
GL_OES_byte_coordinates GL_OES_compressed_paletted_texture GL_OES_fixed_point GL_OES_point_size_array GL_OES_point_sprite GL_IMG_user_clip_planes GL_OES_matrix_palette GL_OES_draw_texture GL_OES_read_format GL_OES_single_precision GL_IMG_texture_compression_pvrtc GL_IMG_texture_env_enhanced_fixed_function GL_ARB_texture_env_combine GL_ARB_texture_env_dot3 GL_OES_matrix_get GL_IMG_vertex_program GL_IMG_read_format  GL_IMG_texture_format_BGRA8888  GL_EXT_multi_draw_arrays 
DBG:COGLES1Texture:37
GL_INVALID_ENUM
Could not generate Texture
DBG:COGLES1Texture:46
Loaded mesh: ../media/sydney.md2
DBG:COGLES1Texture:37
Success to generate Texture
DBG:COGLES1Texture:46
Loaded texture: /root/irrlicht-ogl-es-0303/media/sydney.bmp
Quit message received.
DBG:~COGLES1Texture:70
DBG:~COGLES1Texture:70
XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server "02
      after 18210 requests (18209 known processed) with 0 events remaining.
[root@snoopy bin]# 

________
Ios games
Last edited by seongnam on Fri Feb 25, 2011 9:41 am, edited 1 time in total.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Try to do the testGLError also before the if-block, could be something in the error queue from before.
seongnam
Posts: 28
Joined: Mon Feb 23, 2009 5:53 am

Post by seongnam »

This snippet code generated the error... it should be changed as below to check whether the feature extension is available or not.

Code: Select all

void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)

{

...
#ifdef GL_EXT_texture_filter_anisotropic

	if (FeatureAvailable[IRR_EXT_texture_filter_anisotropic])

		glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &num);

	MaxAnisotropy=static_cast<u8>(num);

#endif
...
}
BTW, I still can't see GUI... that is next debugging item...
________
Love help
Last edited by seongnam on Fri Feb 25, 2011 9:41 am, edited 1 time in total.
Post Reply