irrlicht ogles2 win32 work good~~~

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Post Reply
feelthat
Posts: 194
Joined: Sat Feb 02, 2013 5:27 am

irrlicht ogles2 win32 work good~~~

Post by feelthat »

Win32 libGLESv2.dll use AngleProject instruction set with SSE(not SSE2)

git clone https://chromium.googlesource.com/angle/angle
Revision: cc4ec64cda54f4b138f8d16ce0fe40b8fcedb459
Date: 2013/9/24 Am 02:57:10

Preinstall vs2010 and directX sdk 2010
///
VS2010 build
http://www.mediafire.com/file/n81r28nym ... eGLes2.rar

/////
/////EGL initial
/////
#if defined(_IRR_COMPILE_WITH_OGLES1_) || defined(_IRR_COMPILE_WITH_OGLES2_)
void XmEGLInit()
{
int eRet;
int major = 0;
int minor = 0;
int configs = 0;

int config_attrs[] =
{
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_DEPTH_SIZE, 16,
EGL_STENCIL_SIZE, 8,
EGL_SAMPLE_BUFFERS, 0,
EGL_SAMPLES, 0,
#ifdef _IRR_COMPILE_WITH_OGLES1_
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT,
#else
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
#endif
EGL_NONE, 0
};

/*context_attrs[0] = EGL_CONTEXT_CLIENT_VERSION;
context_attrs[1] = 1;
context_attrs[2] = EGL_NONE;*/

int context_attrs[] =
{
#ifdef _IRR_COMPILE_WITH_OGLES1_
EGL_CONTEXT_CLIENT_VERSION, 1,
#else
EGL_CONTEXT_CLIENT_VERSION, 2,
#endif
EGL_NONE, 0
};

s_egl_display = eglGetDisplay ( g_hDC );

if ( s_egl_display == EGL_NO_DISPLAY )
{
return;
}

if ( !eglInitialize ( s_egl_display, &major, &minor ) )
{
return;
}

if ( !eglChooseConfig ( s_egl_display, config_attrs, &g_egl_config, 1, &configs ) || ( configs != 1 ) )
{
return;
}

s_egl_surface = eglCreateWindowSurface ( s_egl_display, g_egl_config, g_hWnd, 0 );
if ( eglGetError() != EGL_SUCCESS )
{
return;
}

eRet = eglBindAPI( EGL_OPENGL_ES_API );

s_egl_context = eglCreateContext ( s_egl_display, g_egl_config, EGL_NO_CONTEXT, context_attrs );
if ( eglGetError() != EGL_SUCCESS )
{
return;
}

eglMakeCurrent ( s_egl_display, s_egl_surface, s_egl_surface, s_egl_context );
if ( eglGetError() != EGL_SUCCESS )
{
return;
}
}
#endif

//////process egl buffer
if (g_bHasFocus && !g_bIsMinimized)
{
#if defined(_IRR_COMPILE_WITH_OGLES1_) || defined(_IRR_COMPILE_WITH_OGLES2_)
eglSwapBuffers ( s_egl_display, s_egl_surface );
#else
SwapBuffers(g_hDC); //need it
#endif
}

///////destory egl buffer
#if defined(_IRR_COMPILE_WITH_OGLES1_) || defined(_IRR_COMPILE_WITH_OGLES2_)
eglSwapBuffers(s_egl_display, s_egl_surface);
eglMakeCurrent(s_egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );
eglDestroySurface(s_egl_display, s_egl_surface);
eglDestroyContext(s_egl_display, s_egl_context);
eglTerminate(s_egl_display);
#else
if (g_hRC) // Do We Have A Rendering Context?
{
if (!wglMakeCurrent(NULL,NULL)) // Are We Able To Release The DC And RC Contexts?
{
MessageBox(NULL,L"Release Of DC And RC Failed.",L"SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
}

if (!wglDeleteContext(g_hRC)) // Are We Able To Delete The RC?
{
MessageBox(NULL,L"Release Rendering Context Failed.",L"SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
}
g_hRC=NULL; // Set RC To NULL
}
#endif

////full example here
https://github.com/fatalfeel/proton_cm_ ... p/main.cpp
Last edited by feelthat on Sun Dec 25, 2016 2:50 am, edited 2 times in total.
feelthat
Posts: 194
Joined: Sat Feb 02, 2013 5:27 am

Re: irrlicht ogles2 win32 work good~~~

Post by feelthat »

feelthat
Posts: 194
Joined: Sat Feb 02, 2013 5:27 am

Re: irrlicht ogles2 win32 work good~~~

Post by feelthat »

//libGLESv2.dll project bug fixed
//minima window and restore will black fixed

bool Surface::resizeSwapChain(int backbufferWidth, int backbufferHeight)
{
ASSERT(backbufferWidth >= 0 && backbufferHeight >= 0);
ASSERT(mSwapChain);

EGLint status = mSwapChain->resize(backbufferWidth, backbufferHeight);

//fixed here, by stone
mWidth = backbufferWidth;
mHeight = backbufferHeight;

if (status == EGL_CONTEXT_LOST)
{
mDisplay->notifyDeviceLost();
return false;
}
else if (status != EGL_SUCCESS)
{
return error(status, false);
}

//mWidth = backbufferWidth;
//mHeight = backbufferHeight;

return true;
}
Cube_
Posts: 1010
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

Re: irrlicht ogles2 win32 work good~~~

Post by Cube_ »

you might want to consider code tags.

Code: Select all

[code]
[/code]
"this is not the bottleneck you are looking for"
CuteAlien
Admin
Posts: 9634
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: irrlicht ogles2 win32 work good~~~

Post by CuteAlien »

Code tags might help, but more important would be a description of why this code is posted. What is this about? Is it about a bug in Irrlicht? Something we should change?

When you post code without explaining why you post it - I just have no idea what it is about. We need at least some context.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
feelthat
Posts: 194
Joined: Sat Feb 02, 2013 5:27 am

Re: irrlicht ogles2 win32 work good~~~

Post by feelthat »

surface.cpp's bug from git clone https://chromium.googlesource.com/angle/angle

its a ogles2 GLSL to HLSL tool~~~



bool Surface::resizeSwapChain(int backbufferWidth, int backbufferHeight)
{
ASSERT(backbufferWidth >= 0 && backbufferHeight >= 0);
ASSERT(mSwapChain);

EGLint status = mSwapChain->resize(backbufferWidth, backbufferHeight);

//by stone
mWidth = backbufferWidth;
mHeight = backbufferHeight;

if (status == EGL_CONTEXT_LOST)
{
mDisplay->notifyDeviceLost();
return false;
}
else if (status != EGL_SUCCESS)
{
return error(status, false);
}

//mWidth = backbufferWidth;
//mHeight = backbufferHeight;

return true;
}
CuteAlien wrote:Code tags might help, but more important would be a description of why this code is posted. What is this about? Is it about a bug in Irrlicht? Something we should change?

When you post code without explaining why you post it - I just have no idea what it is about. We need at least some context.
Last edited by feelthat on Sun Dec 25, 2016 2:49 am, edited 1 time in total.
CuteAlien
Admin
Posts: 9634
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: irrlicht ogles2 win32 work good~~~

Post by CuteAlien »

So you just post more code but still don't write *why* you post that code? I remember we had that exact same discussion in the past...

Really - as long as you don't explain what this is about I have no clue what this is about.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
feelthat
Posts: 194
Joined: Sat Feb 02, 2013 5:27 am

Re: irrlicht ogles2 win32 work good~~~

Post by feelthat »

AngleProject provide GLSL to win32 HLSL

i modify AngleProject for irrlicht on win32 using

after building AngleProject will generate libGLESv2.dll and libGLESv2.lib we can link this lib~~~

libGLESv2.dll and libGLESv2.lib are OGLES2 simulator on win32

it's easier debug GLSL shading language on win32

CuteAlien wrote:So you just post more code but still don't write *why* you post that code? I remember we had that exact same discussion in the past...

Really - as long as you don't explain what this is about I have no clue what this is about.
Post Reply