Polygon primitive

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

Re: Polygon primitive

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

No problem,
I'm excited to try it out this weekend!
Thanks
User avatar
RealMayo
 
Posts: 1682
Joined: Sat Sep 03, 2011 9:25 pm
Location: Chicago, IL

Re: Polygon primitive

Postby IFL » Fri Feb 17, 2012 2:15 am

Rodrigo, you're awesome. I've had trouble updating the points of the polygon... but I've temporarily gotten around that by re-creating the textured poly every time it needs to change. That's a rather slow method though, so am I missing something about updating the polygon? I get an "array index out of bounds" error inside of the TexturedPolygon Update(x[],y[]) method even if I pass the same number of points... But it's good so far. I got an image centered using high-level code and it's clamped by default if you don't use a repeating texture so I'm more than happy. Take a look:
AELightRays.gif
AELightRays.gif (901.69 KiB) Viewed 2164 times
User avatar
IFL
 
Posts: 177
Joined: Fri Mar 04, 2011 6:28 am

Re: Polygon primitive

Postby jgibbs » Fri Feb 17, 2012 9:29 am

recastrodiaz wrote: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".



Sheesh, I spend 4 days recovering from a HDD failure and get back to EXACTLY what I was trying to achieve. 1000 thank you's for doing this, it was the only thing I couldn't get going to move on with my project. It looks perfect in my game world, now I can get my artist to build some tile textures for my terrain. :D
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 » Fri Feb 17, 2012 11:45 am

IFL wrote:Rodrigo, you're awesome. I've had trouble updating the points of the polygon... but I've temporarily gotten around that by re-creating the textured poly every time it needs to change. That's a rather slow method though, so am I missing something about updating the polygon? I get an "array index out of bounds" error inside of the TexturedPolygon Update(x[],y[]) method even if I pass the same number of points... But it's good so far. I got an image centered using high-level code and it's clamped by default if you don't use a repeating texture so I'm more than happy. Take a look:
AELightRays.gif


The problem is that you can't control de number of vertices the triangulation algorithm computes. If the polygon needs more triangles it will need more space to save the additional data. That's why I added a sizeRatio parameter to the constructors (not quite usable in the last Polygon version :P ). You could pass a sizeRatio > 1 to allocate a larger vertex list and avoid the array index out of bounds exception.

PS : your AELightRays looks good ;)
Last edited by recastrodiaz on Fri Feb 17, 2012 11:47 am, edited 1 time in total.
recastrodiaz
 
Posts: 26
Joined: Mon Aug 22, 2011 11:32 pm
Location: Lyon, France

Re: Polygon primitive

Postby recastrodiaz » Fri Feb 17, 2012 11:46 am

I'm glad it is already useful for some of you 8-)
recastrodiaz
 
Posts: 26
Joined: Mon Aug 22, 2011 11:32 pm
Location: Lyon, France

Re: Polygon primitive

Postby IFL » Fri Feb 17, 2012 4:55 pm

recastrodiaz wrote:The problem is that you can't control de number of vertices the triangulation algorithm computes. If the polygon needs more triangles it will need more space to save the additional data. That's why I added a sizeRatio parameter to the constructors (not quite usable in the last Polygon version :P ). You could pass a sizeRatio > 1 to allocate a larger vertex list and avoid the array index out of bounds exception.

I've worked on getting it to update the polygon with your guidance (sizeRatio>1), but I've had little luck. Thank you for the work that you've put into this so far.

recastrodiaz wrote:PS : your AELightRays looks good ;)

Thanks - it was just a humble test that wouldn't have even been possible without your code.
User avatar
IFL
 
Posts: 177
Joined: Fri Mar 04, 2011 6:28 am

Re: Polygon primitive

Postby gst » Tue Feb 28, 2012 1:52 pm

recastrodiaz wrote:I have a working GLES2 implementation and an example using it in my github forks :
https://github.com/recastrodiaz/AndEngine
https://github.com/recastrodiaz/AndEngi ... ample.java
It is not fully tested and it lacks some features, but does render convex and non convex polygons.
Let me know what you think and what features you might need. Any help is welcome.


Hi,

I'm trying to test your class, but I can't compile it.
I have two problems:

- First: my andengine extension (cloned) don't have "org.andengine...." package, instead I have "org.anddev.andengine...", so I have to rename the imports.

- Second: This imports (see below) are not recognized, as they are missing on the andengine extension. I have only Line, Rectangle and BaseRectangle.

import org.andengine.entity.primitive.Ellipse;
import org.andengine.entity.primitive.PolyLine;
import org.andengine.entity.primitive.Polygon;

I have the same error with other "polygon" sample I found here on the forum.

What I'm doing wrong?

Also, when I try to clone this repository "https://github.com/nicolasgramlich/AndEngine.git" I receive an error: " HTTP Error 406: Not Acceptable".

I'm starting working with AndEngine and Eclipse, so I'm lost. :(

Thanks in advance!
gst
 
Posts: 10
Joined: Thu Feb 23, 2012 1:57 pm

Re: Polygon primitive

Postby RealMayo » Tue Feb 28, 2012 5:34 pm

Hi gst,
It sounds like you might be using AnEngine GLES1. If so then remove everything from Eclipse and then follow my tutorial for AndEngine GLES2.
Finally you will need to replace AmdEngine itself with recasrodiaz version of AndEngine.
User avatar
RealMayo
 
Posts: 1682
Joined: Sat Sep 03, 2011 9:25 pm
Location: Chicago, IL

Re: Polygon primitive

Postby gst » Tue Feb 28, 2012 5:57 pm

RealMayo wrote:Hi gst,
It sounds like you might be using AnEngine GLES1. If so then remove everything from Eclipse and then follow my tutorial for AndEngine GLES2.
Finally you will need to replace AmdEngine itself with recasrodiaz version of AndEngine.


Thanks for your answer.
But I continue with some problems. When I try to clone this repository "https://github.com/nicolasgramlich/AndEngine.git" I receive an error: " HTTP Error 406: Not Acceptable".

I'm using the Mercurial clone option "Clone Existing Mercurial Reposotory".
As I see in your video, you use a Git.
gst
 
Posts: 10
Joined: Thu Feb 23, 2012 1:57 pm

Re: Polygon primitive

Postby RealMayo » Tue Feb 28, 2012 6:26 pm

gst wrote:Thanks for your answer.
But I continue with some problems. When I try to clone this repository "https://github.com/nicolasgramlich/AndEngine.git" I receive an error: " HTTP Error 406: Not Acceptable".

I'm using the Mercurial clone option "Clone Existing Mercurial Reposotory".
As I see in your video, you use a Git.


You can NOT use Mercurial with "https://github.com/nicolasgramlich/AndEngine.git"
Please follow my GLES2 tutorial...
User avatar
RealMayo
 
Posts: 1682
Joined: Sat Sep 03, 2011 9:25 pm
Location: Chicago, IL

PreviousNext

Return to GLES2

Who is online

Users browsing this forum: No registered users and 33 guests