Irrlicht + cocos2d code discussion on ios
Irrlicht + cocos2d code discussion on ios
//Both use EAGLView.mm, irrlicht i use proton be a base code, so I post them here
Last edited by feelthat on Tue Mar 17, 2015 9:49 am, edited 3 times in total.
Re: Irrlicht + cocos2d code discussion on ios
Research EGL view some part the same~
Last edited by feelthat on Tue Mar 17, 2015 8:52 am, edited 1 time in total.
Re: Irrlicht + cocos2d code discussion on ios
from Mun author's answer~~
I’ve used one EGL layer.
I’ve first drawn irrlicht, then cocos2d.
In addition, it is still important that OpenGL-E should recover state like glEnable, glBindTexture, etc.
Especially, remember OpenGL is a sort of State Machine.
I’ve used one EGL layer.
I’ve first drawn irrlicht, then cocos2d.
In addition, it is still important that OpenGL-E should recover state like glEnable, glBindTexture, etc.
Especially, remember OpenGL is a sort of State Machine.
Re: Irrlicht + cocos2d code discussion on ios
check "Mixed Cocos2D and Irricht3D Engine Demo"
feelthat wrote:from Mun author's answer~~
I’ve used one EGL layer.
I’ve first drawn irrlicht, then cocos2d.
In addition, it is still important that OpenGL-E should recover state like glEnable, glBindTexture, etc.
Especially, remember OpenGL is a sort of State Machine.
Last edited by feelthat on Fri Feb 20, 2015 8:52 pm, edited 2 times in total.
Re: Irrlicht + cocos2d code discussion on ios
Wish someday irrlicht 3d support cocos2d's like GUI
code from author Mun
https://code.google.com/p/xmframework/
hope you like it~
code from author Mun
https://code.google.com/p/xmframework/
hope you like it~
Last edited by feelthat on Sat Feb 21, 2015 6:42 pm, edited 5 times in total.
Re: Irrlicht + cocos2d code discussion on ios
here is cocos2d 1.0.1 and i do a little example before~~ Wish someday irrlicht 3d support cocos2d menu
old version cocos2d is easy to compare GLview code
http://www.mediafire.com/download/e3tsi ... 121106.rar
old version cocos2d is easy to compare GLview code
http://www.mediafire.com/download/e3tsi ... 121106.rar
Re: Irrlicht + cocos2d code discussion on ios
// Xp platform need modify
int xmWinLink ( const KDchar* oldfile, const KDchar* newname )
{
#if !defined ( _WIN32_WCE )
TCHAR* toldpath = KD_NULL;
TCHAR* tnewpath = KD_NULL;
KDint ret = 0;
XM_SET_TSTR ( toldpath, oldfile );
XM_SET_TSTR ( tnewpath, newname );
//if ( CreateSymbolicLink ( toldpath, tnewpath, 0 ) == FALSE ) //please mark this line
{
xmWinDosMapErr ( GetLastError ( ) );
ret = -1;
}
KD_FREE_TSTR ( toldpath );
KD_FREE_TSTR ( tnewpath );
return ret;
#else
return -1;
#endif
}
/////////
copy libegl.dll and some dlls to 04_Sample\Mixed_Cocos2D_Irrlicht\Build\Win32-vc2008
then press F5 run
here is my demo
https://plus.google.com/photos/10618554 ... 8774360364
int xmWinLink ( const KDchar* oldfile, const KDchar* newname )
{
#if !defined ( _WIN32_WCE )
TCHAR* toldpath = KD_NULL;
TCHAR* tnewpath = KD_NULL;
KDint ret = 0;
XM_SET_TSTR ( toldpath, oldfile );
XM_SET_TSTR ( tnewpath, newname );
//if ( CreateSymbolicLink ( toldpath, tnewpath, 0 ) == FALSE ) //please mark this line
{
xmWinDosMapErr ( GetLastError ( ) );
ret = -1;
}
KD_FREE_TSTR ( toldpath );
KD_FREE_TSTR ( tnewpath );
return ret;
#else
return -1;
#endif
}
/////////
copy libegl.dll and some dlls to 04_Sample\Mixed_Cocos2D_Irrlicht\Build\Win32-vc2008
then press F5 run
here is my demo
https://plus.google.com/photos/10618554 ... 8774360364
Re: Irrlicht + cocos2d code discussion on ios
will add ogles2 version, please wait
Re: Irrlicht + cocos2d code discussion on ios
ios done
https://plus.google.com/photos/10618554 ... banner=pwa
https://plus.google.com/photos/10618554 ... banner=pwa
feelthat wrote:will add ogles2 version, please wait
irrlicht + cocos2d ogles1 ogles2 tutorial
//proton 3 version
https://github.com/fatalfeel/proton_sdk_source
//cocos2d version
https://code.google.com/p/cocos2d-x/dow ... p&can=1&q=
1.
cocos2d-2.0-rc2-x-2.0.1.zip is a ogles2 version
change code to ogles1 in win32, use USE_OPEN_GLES2 split ogles1/ogles2
example:
void ccGLEnableVertexAttribs ( KDuint uFlags )
{
ccGLBindVAO ( 0 );
// Position
bool bEnablePosition = uFlags & kCCVertexAttribFlag_Position;
if ( bEnablePosition != l_bVertexAttribPosition )
{
( bEnablePosition ) ?
#if defined ( USE_OPEN_GLES2 )
glEnableVertexAttribArray ( kCCVertexAttrib_Position ) :
glDisableVertexAttribArray ( kCCVertexAttrib_Position ) ;
#else
glEnableClientState ( GL_VERTEX_ARRAY ) :
glDisableClientState ( GL_VERTEX_ARRAY ) ;
#endif
l_bVertexAttribPosition = bEnablePosition;
}
// Color
bool bEnableColor = ( uFlags & kCCVertexAttribFlag_Color ) != 0 ? KD_TRUE : KD_FALSE;
if ( bEnableColor != l_bVertexAttribColor )
{
( bEnableColor ) ?
#if defined ( USE_OPEN_GLES2 )
glEnableVertexAttribArray ( kCCVertexAttrib_Color ) :
glDisableVertexAttribArray ( kCCVertexAttrib_Color ) ;
#else
glEnableClientState ( GL_COLOR_ARRAY ) :
glDisableClientState ( GL_COLOR_ARRAY ) ;
#endif
l_bVertexAttribColor = bEnableColor;
}
// Tex Coords
bool bEnableTexCoords = ( uFlags & kCCVertexAttribFlag_TexCoords ) != 0 ? TRUE : FALSE;
if ( bEnableTexCoords != l_bVertexAttribTexCoords )
{
if ( bEnableTexCoords )
{
#if defined ( USE_OPEN_GLES2 )
glEnableVertexAttribArray ( kCCVertexAttrib_TexCoords );
#else
glEnable ( GL_TEXTURE_2D );
glEnableClientState ( GL_TEXTURE_COORD_ARRAY );
#endif
}
else
{
#if defined ( USE_OPEN_GLES2 )
glDisableVertexAttribArray ( kCCVertexAttrib_TexCoords );
#else
glDisable ( GL_TEXTURE_2D );
glDisableClientState ( GL_TEXTURE_COORD_ARRAY );
#endif
}
l_bVertexAttribTexCoords = bEnableTexCoords;
}
}
//////////
void ccGLVertexAttribPointer ( GLuint uAttrib, GLint nSize, GLenum uType, GLboolean bNormalized, GLsizei nStride, const GLvoid* pPtr )
{
#if defined ( USE_OPEN_GLES2 )
glVertexAttribPointer ( uAttrib, nSize, uType, bNormalized, nStride, pPtr );
#else
switch ( uAttrib )
{
case kCCVertexAttrib_Position : glVertexPointer ( nSize, uType, nStride, pPtr ); break;
case kCCVertexAttrib_TexCoords : glTexCoordPointer ( nSize, uType, nStride, pPtr ); break;
case kCCVertexAttrib_Color : glColorPointer ( nSize, uType, nStride, pPtr ); break;
}
#endif
}
2.
combine proton and cocos2d ogles1 version
example here:
https://github.com/fatalfeel/proton_cm_open
3.
move to xcode ios combine proton and cocos2d ogles1
4. select USE_OPEN_GLES2 use ogles2 in xcode
5. move code to win32 combine ogles2 version
https://github.com/fatalfeel/proton_sdk_source
//cocos2d version
https://code.google.com/p/cocos2d-x/dow ... p&can=1&q=
1.
cocos2d-2.0-rc2-x-2.0.1.zip is a ogles2 version
change code to ogles1 in win32, use USE_OPEN_GLES2 split ogles1/ogles2
example:
void ccGLEnableVertexAttribs ( KDuint uFlags )
{
ccGLBindVAO ( 0 );
// Position
bool bEnablePosition = uFlags & kCCVertexAttribFlag_Position;
if ( bEnablePosition != l_bVertexAttribPosition )
{
( bEnablePosition ) ?
#if defined ( USE_OPEN_GLES2 )
glEnableVertexAttribArray ( kCCVertexAttrib_Position ) :
glDisableVertexAttribArray ( kCCVertexAttrib_Position ) ;
#else
glEnableClientState ( GL_VERTEX_ARRAY ) :
glDisableClientState ( GL_VERTEX_ARRAY ) ;
#endif
l_bVertexAttribPosition = bEnablePosition;
}
// Color
bool bEnableColor = ( uFlags & kCCVertexAttribFlag_Color ) != 0 ? KD_TRUE : KD_FALSE;
if ( bEnableColor != l_bVertexAttribColor )
{
( bEnableColor ) ?
#if defined ( USE_OPEN_GLES2 )
glEnableVertexAttribArray ( kCCVertexAttrib_Color ) :
glDisableVertexAttribArray ( kCCVertexAttrib_Color ) ;
#else
glEnableClientState ( GL_COLOR_ARRAY ) :
glDisableClientState ( GL_COLOR_ARRAY ) ;
#endif
l_bVertexAttribColor = bEnableColor;
}
// Tex Coords
bool bEnableTexCoords = ( uFlags & kCCVertexAttribFlag_TexCoords ) != 0 ? TRUE : FALSE;
if ( bEnableTexCoords != l_bVertexAttribTexCoords )
{
if ( bEnableTexCoords )
{
#if defined ( USE_OPEN_GLES2 )
glEnableVertexAttribArray ( kCCVertexAttrib_TexCoords );
#else
glEnable ( GL_TEXTURE_2D );
glEnableClientState ( GL_TEXTURE_COORD_ARRAY );
#endif
}
else
{
#if defined ( USE_OPEN_GLES2 )
glDisableVertexAttribArray ( kCCVertexAttrib_TexCoords );
#else
glDisable ( GL_TEXTURE_2D );
glDisableClientState ( GL_TEXTURE_COORD_ARRAY );
#endif
}
l_bVertexAttribTexCoords = bEnableTexCoords;
}
}
//////////
void ccGLVertexAttribPointer ( GLuint uAttrib, GLint nSize, GLenum uType, GLboolean bNormalized, GLsizei nStride, const GLvoid* pPtr )
{
#if defined ( USE_OPEN_GLES2 )
glVertexAttribPointer ( uAttrib, nSize, uType, bNormalized, nStride, pPtr );
#else
switch ( uAttrib )
{
case kCCVertexAttrib_Position : glVertexPointer ( nSize, uType, nStride, pPtr ); break;
case kCCVertexAttrib_TexCoords : glTexCoordPointer ( nSize, uType, nStride, pPtr ); break;
case kCCVertexAttrib_Color : glColorPointer ( nSize, uType, nStride, pPtr ); break;
}
#endif
}
2.
combine proton and cocos2d ogles1 version
example here:
https://github.com/fatalfeel/proton_cm_open
3.
move to xcode ios combine proton and cocos2d ogles1
4. select USE_OPEN_GLES2 use ogles2 in xcode
5. move code to win32 combine ogles2 version
proton + cocos2de-x win32
https://plus.google.com/photos/10618554 ... 8774360364
proton + cocos2de-x win32
ogles1 and ogles2 both work on win32
https://github.com/fatalfeel/proton_cm_open
proton + cocos2de-x win32
ogles1 and ogles2 both work on win32
https://github.com/fatalfeel/proton_cm_open
feelthat wrote:ios done
https://plus.google.com/photos/10618554 ... banner=pwa
feelthat wrote:will add ogles2 version, please wait
Re: Irrlicht + cocos2d code discussion on ios
ios ogles1 ogles2 done~