Open DerekBronson opened 10 years ago
I confirmed this issue on iOS today.
Just for fun I had a look through the code - trying to figure out how rendering works in T2D left me with a headache.
All the GUI stuff goes through dgl - but then anything in the batch renderer gets direct OpenGL calls? And then figuring out what each platform does....ugh...
I'm guessing the fun starts in BatchRender.cc line 377:
if ( mWireframeMode )
{
// Disable texturing.
glDisable( GL_TEXTURE_2D );
// Set the polygon mode to line.
glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
}
Is GL_TEXTURE_2D supported on iOS and Android? In iOSGL2ES.h it is commented out. There's also a file called iOSOutlineGL which has this comment inside it:
// The debug render modes are only built in a debug build,
// partially because a release build should not need them
// and partially because using aglMacro.h or cglMacro.h would prevent us from
// playing this little function-pointer-hijacking trick
#if defined(TORQUE_DEBUG)
Again, guessing this code is from the old iTorque stuff, not sure if this is the reason why things aren't working.
Looking into this a bit more: it appears that glPolygonMode is not a valid API call in OpenGL ES 2.0 and the wrapper method for this function is not implemented, see iOSGL2ES.mm or equivalent. I think the appropriate code is available from iOSOutlineGL.mm - it would just have to be ripped out of that file and placed in right spot in BatchRender.cc, without the debug build toggle.
As lilligreen mentioned, glPolyonMode isn't valid in OpenGL ES. The only way to make wireframe work (that I'm aware of) is either using shaders or manually drawing the wireframe using something like GL_LINE_STRIP.
Given #156 we need to consider rewriting the ShapeVector class altogether. I'll take a look at this and see if I can get something put together that works across all of the platforms.
This should be corrected now in dev. We need someone to confirm that this is fixed on one of the affected platforms.
Peter, just to clarify: ShapeVector should now render in wireframe mode across all platforms but other classes won't. The reason is BatchRenderer still relies on glPolygonMode() to draw wireframes, but this function doesn't exist in OpenGL ES. I'll see if I can get wireframe working across the board and submit another PR.
Branch: Development Platforms: iOS, Android, Emscripten Description: Wireframe mode draws filled polygons. May be due to a bug in opengl es. Reported: