Page 1 of 1

irrlicht ogles2 win32 work good~~~

Posted: Mon Jun 29, 2015 8:54 pm
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

Re: irrlicht ogles2 win32 work good~~~

Posted: Mon Jun 29, 2015 9:09 pm
by feelthat

Re: irrlicht ogles2 win32 work good~~~

Posted: Mon Jun 29, 2015 10:36 pm
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;
}

Re: irrlicht ogles2 win32 work good~~~

Posted: Mon Jun 29, 2015 11:29 pm
by Cube_
you might want to consider code tags.

Code: Select all

[code]
[/code]

Re: irrlicht ogles2 win32 work good~~~

Posted: Tue Jun 30, 2015 5:23 pm
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.

Re: irrlicht ogles2 win32 work good~~~

Posted: Wed Jul 01, 2015 12:20 pm
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.

Re: irrlicht ogles2 win32 work good~~~

Posted: Wed Jul 01, 2015 1:21 pm
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.

Re: irrlicht ogles2 win32 work good~~~

Posted: Fri Jul 10, 2015 10:45 pm
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.