orxDisplay_DrawMesh Android texture coordinate bug

Hi Everyone,

First of all, it feels nice to post on the Orx forums after a long break. I hope you're all doing well.

Diving right into the issue: I've recently started using the orxDisplay_DrawMesh function, and it has been working perfectly in Linux. Now, I've tried porting a project using the function to Android, and I observe some issues related to the texture coordinates.

What I do is: while handling the rendering of an object with a texture, I try to draw a triangle to the upper left corner of the screen, and the triangle spans the texture coordinates from 0.0 to 1.0 in both the U and V axes. Just to be sure that the object does indeed have a valid texture, I also return orxSTATUS_SUCCESS from the handler, in order to see the object itself too.

With this very simple setup, I observe the expected result under Linux, where I have the textured object in the middle of the screen, and also the correctly textured triangle at the upper left corner of the screen. When I try the same in Android, the result is the same except that the triangle is uniformly colored. I've observed that the color that the triangle assumes is exactly the pixel at the lower right corner of the texture. I would like to stress that I do observe the correct texture on the object.

Here's what I see in Linux (left) vs. in Android (right)

screenshots.png

Here's the rendering event handler:
orxBOOL OnRender(orxRENDER_EVENT_OBJECT_PAYLOAD *_pstPayload){
	const orxBITMAP * _pstBitmap = orxTexture_GetBitmap(orxTEXTURE(orxGraphic_GetData(orxOBJECT_GET_STRUCTURE(GetOrxObject(), GRAPHIC))));

	vector<orxDISPLAY_VERTEX> astVertexList;

	astVertexList.push_back({0.0,0.0,0.0,0.0,orx2RGBA(0xFF, 0xFF, 0xFF, 0xFF)});
	astVertexList.push_back({100.0,0.0,1,0.0,orx2RGBA(0xFF, 0xFF, 0xFF, 0xFF)});
	astVertexList.push_back({100.0,100.0,1,1,orx2RGBA(0xFF, 0xFF, 0xFF, 0xFF)});

	orxDisplay_DrawMesh(_pstBitmap, orxDISPLAY_SMOOTHING_ON, orxDISPLAY_BLEND_MODE_ALPHA, astVertexList.size(), astVertexList.data());
	return orxSTATUS_SUCCESS;
}

Note that I'm using the latest Orx version from the Mercurial repository.

I tried to dive into the source code and catch some place where the texture coordinates are set to constant values but I got lost in the code.

Thanks in advance!

Comments

  • edited April 2013
    Hi enobayram, nice to see you around! :)

    As for your question, I'll let lydesik/faistoiplaisir handle this, they're much more familiar with the Android code than me.
  • edited April 2013
    I tried to reproduce your setup in iOS which made me discover a copy/paste bug in the iOS version.
    After fixing it, everything looks normal on iOS. I noticed that the Android version was suffering from the same copy/paste bug, so I fixed it but I have no ways to test it.
    If you sync the latest, lemme know if you still have the problem. :)
  • edited April 2013
    Hi Iarwain, nice to see you too :)

    I've retried the same setup and now it works on Android too, you're the best!
  • edited April 2013
    Ah nice, I like happy endings! :)
Sign In or Register to comment.