drawing textured triangles

Is it possible to draw a textured triangle in CocosSharp? (not sprite-based... custom triangles, for example for drawing a (2d) mesh)

I've been searching for some time (I'm a total n00b in CocosSharp (and Cocos XNA, MonoGame...) world!), but I've always come to an dead end:

  • CCDrawingPrimitives is great, but a shape can only have a solid color here - no textures
  • as I understand, custom shaders are not yet supported in CocosSharp
  • Cocos2d (non-CocosSharp) examples show that one can use GL commands (glDrawArrays, for example) - is that possible in CocosSharp as well?
  • unfortunately, CCDrawManager is not accessible (internal access modifier)

I understand that Cocos-2D is all about sprites, but drawing a textured custom shape is often needed as well (not to mention meshes in Cocos-3D CocosSharp).

Is there any chance that CCDrawManager will become public? (That would enable the possibility of drawing textured triangles, I suppose?) (Accessing CCDrawManager using reflection is not really a good option.)

Any other suggestions on how to draw a simple shape/triangle with (multiple) texture(s) in CocosSharp?

Posts

  • kjpou1kjpou1 LUMember, Xamarin Team Xamurai

    Hey Alex

    We have tried to keep as much of the underlying platform interface tucked away because of the PCL implementation. glDrawArrays will not be accessible to you since it is OpenGL only and would not be cross platform and MonoGame does not surface anything for that.

    What exactly are you needing access to so that we can take a look at surfacing a usable interface.

  • AlesGolliAlesGolli SIMember

    I'm looking for a way to draw textured triangles. I guess that would be possible by somehow utilizing CCDrawManager.DrawPrimitives(), to feed it with a triangle-list (CCPrimitiveBatch?).

    I'm new to CocosSharp, so I'm not sure what/where the most appropriate interface would be to accomplish that. Would it be possible to extend CCDrawingPrimitives to support textures? (and a batch of PrimitiveType.TriangleList as input)

  • kjpou1kjpou1 LUMember, Xamarin Team Xamurai
    edited January 2015

    Alex

    No way to really modify the DrawPrimitives as that is not it's purpose. We will need to look into something else.

    I have set up a feature request issue here

    1. Interface created to allow drawing textured triangles
      or
    2. Open CCDrawManger to be public so developers have access to lower functions

    Thank you for bringing this to our attention. Let's see what we can come up with.

  • AlesGolliAlesGolli SIMember

    Great, I'm looking forward to it, thanks!

    I hope that the interface will support multi-texturing & most common OpenGL blending modes.

  • kjpou1kjpou1 LUMember, Xamarin Team Xamurai

    Alex

    See here

    You will have to compile from source or wait for next release.

Sign In or Register to comment.