Polygon primitive

  ... discussions about development with the GLES2 branch of AndEngine.

Re: Polygon primitive

Postby recastrodiaz » Mon Feb 13, 2012 11:28 pm

I don't think you could easily repeat the texture tiles as in your example. You could either break your terrain in smaller polygons, each mapped to a texture or have a big texture mapped to your polygon terrain which you will "deform" to get more or less the effect you are looking for. Both examples would use the same 3D techniques you're used to.

In any case, you can't yet map a texture to a Polygon, but you're free to help ;)

Speaking of, the polygon class is going to change quite a bit in the days to come, stay tuned.

PS : Sorry for the late response.

Edit: Never mind what I've just said, in fact you could repeat the texture tiles as you suggested by using the gles option GL_REPEAT.
recastrodiaz
 
Posts: 26
Joined: Mon Aug 22, 2011 11:32 pm
Location: Lyon, France

Re: Polygon primitive

Postby RealMayo » Tue Feb 14, 2012 12:05 am

GL_REPEAT is only for sprites as well as the entire background of a scene. It is not for filling a polygon :cry:
We eagerly await the day that we can fill a polygon with a repeating texture :|
User avatar
RealMayo
 
Posts: 1683
Joined: Sat Sep 03, 2011 9:25 pm
Location: Chicago, IL

Re: Polygon primitive

Postby recastrodiaz » Tue Feb 14, 2012 12:34 am

I was talking about OpenGL in general, not about andengine itself. Check "Repeating and Clamping Textures" at http://fly.cc.fer.hr/~unreal/theredbook/chapter09.html to get a better idea of what I meant.
recastrodiaz
 
Posts: 26
Joined: Mon Aug 22, 2011 11:32 pm
Location: Lyon, France

Re: Polygon primitive

Postby IFL » Tue Feb 14, 2012 5:45 am

Recastrodiaz, if you figure out and share a method of applying a texture (that is not warped or repeated) to a non-static concave polygon, I'll give you a nice present ( :money: ) and include you in credits when appropriate.
User avatar
IFL
 
Posts: 177
Joined: Fri Mar 04, 2011 6:28 am

Re: Polygon primitive

Postby jgibbs » Tue Feb 14, 2012 7:29 am

recastrodiaz wrote:I was talking about OpenGL in general, not about andengine itself. Check "Repeating and Clamping Textures" at http://fly.cc.fer.hr/~unreal/theredbook/chapter09.html to get a better idea of what I meant.


That's where I was heading with my idea. I started pulling apart the sprite class and merging what I could into the polygon class to get it being textured, but I'm not as familiar with Java as my bread and butter language (c++). I started getting lost bringing the textures and GL draw code into the polygon class. At that point I thought I'd better cast my question out before I wasted too much time on something that might not actually be possible, or that someone else knew better than me.
Check out my adventures into Android programming:

4x4 Adventures - Featured in the Top Free Play Store listings
Slippery Sid
jgibbs
 
Posts: 105
Joined: Fri Nov 25, 2011 9:32 am
Location: New Zealand

Re: Polygon primitive

Postby recastrodiaz » Wed Feb 15, 2012 2:45 pm

I've just pushed an experimental "uvmesh" branch that adds support for textured polygons. Feel free to test it.

Image

@IFL what do you understand by "not warped nor repeated texture".
recastrodiaz
 
Posts: 26
Joined: Mon Aug 22, 2011 11:32 pm
Location: Lyon, France

Re: Polygon primitive

Postby RealMayo » Wed Feb 15, 2012 8:08 pm

Does it allow for applying a repeating PNG image to the polygon?
User avatar
RealMayo
 
Posts: 1683
Joined: Sat Sep 03, 2011 9:25 pm
Location: Chicago, IL

Re: Polygon primitive

Postby recastrodiaz » Wed Feb 15, 2012 8:28 pm

Yes, but you can't control yet where to place the texture "inside" the polygon :
https://github.com/recastrodiaz/AndEngi ... e.java#L68
and
https://github.com/recastrodiaz/AndEngi ... .java#L116
recastrodiaz
 
Posts: 26
Joined: Mon Aug 22, 2011 11:32 pm
Location: Lyon, France

Re: Polygon primitive

Postby RealMayo » Wed Feb 15, 2012 8:32 pm

So then what is the default behavior of the positioning/placement?
User avatar
RealMayo
 
Posts: 1683
Joined: Sat Sep 03, 2011 9:25 pm
Location: Chicago, IL

Re: Polygon primitive

Postby recastrodiaz » Wed Feb 15, 2012 8:44 pm

Random ;)
Not really, For now, I just match the local origin of the polygon with the origin of the texture, flipping and rotating the texture won't do anything either.
recastrodiaz
 
Posts: 26
Joined: Mon Aug 22, 2011 11:32 pm
Location: Lyon, France

PreviousNext

Return to GLES2

Who is online

Users browsing this forum: Google [Bot] and 35 guests