Jump to content
  • Advertisement

alireza.pir

Member
  • Content Count

    29
  • Joined

  • Last visited

Community Reputation

246 Neutral

About alireza.pir

  • Rank
    Member

Personal Information

  • Role
    Programmer
  • Interests
    Design
    DevOps
    Programming
  1. Hello,   Does Strategy Games Like Clash of Clans Or... use a unique pattern or formula for economy and other things in their game?'   for example how many hours should upgrading a bulding take, or how much it costs, how much get reward from a battle, or even what should be the scale of money or special goods in the game.   and if answer is yes, (That i think sourly it Must be yes) How can I find things like that for my own game?  
  2. alireza.pir

    OpenGL ES - Dashed Lines

      There's no stippled lines in OpenGL ES.       Yes, you should texture it. Make small 1D texture (4-8 pixels wide), large enough to hold desired dash pattern. Add texture coordinates to your line vertices. Line's first vertex S coord can be at texture's 0, and second vertex S coord should be set depending on line's length, and how dense you want dash pattern. Enable texture wrapping, so pattern will be repeated along line. Draw with blending or alpha test, depending on your needs.     Thanks, Is There Any Tutorial Or Link for How to Do this? or Could You give me a simple code?
  3. im Using OpenGlEs10 for My Android Game Development, I Want to Draw Dashed-lines Now Im Using This Code to Draw My Line: gl.glColor4f(1.0f, 0.0f, 0.0f, 1.0f); // gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA); gl.glLineWidth(4.0f); gl.glVertexPointer(2, GL10.GL_FLOAT, 0, mBufDestVertices); gl.glDrawArrays(GL10.GL_LINE_LOOP, 0, mDesPoly.getNumPoints()); How Should I Change It? Does I have to Texture The line? And if so, How?
  4. i am developing an android game using Eclipse and OpenGlES1.0 it almost finished, but i want to port my game also for iphone, what is the best and fastest way to do this?
  5. sorry this is the right code:   if (DRAW_DEST_POLY && DrawDest) { gl.glEnable(GL10.GL_BLEND); gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA); gl.glLineWidth(2.0f); gl.glPointSize(3f); gl.glColor4f(0.8f, 0.0f, 0.0f, 1.0f); gl.glVertexPointer(2, GL10.GL_FLOAT, 0, mBufDestVertices); gl.glDrawArrays(GL10.GL_LINE_LOOP, 0, OpenglPoly.getNumPoints()); gl.glDisable(GL10.GL_BLEND); }
  6. I have A part of code in my Android App that gives me two diffrent Outputs for Two Adreno And Mali GPU: For Mali GPU For Adreno GPU And this is the Code: if (DRAW_DEST_POLY && DrawDest) { gl.glEnable(GL10.GL_BLEND); gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA); gl.glLineWidth(2.0f); gl.glPointSize(3f); gl.glColor4f(0.8f, 0.0f, 0.0f, 1.0f); gl.glVertexPointer(2, GL10.GL_FLOAT, 0, mBufDestVertices); gl.glDrawArrays(GL10.GL_LINE_LOOP, 0, OpenglPoly.getNumPoints()); gl.glDisable(GL10.GL_BLEND); } I want the OutPut to be like what in Mali GPU is. (the problem is the inner shape that in second image has faded out)
  7. in my android App, i have a Frame Buffer Object that takes me the rendered Scene As a texture. I want to some How, Convert this Texture to A 2d-Array filled with 0 and 1, 0 for transparency pixel, and 1 for Colored pixel of texture. i need this to then compare this result with a previously Known 2d-Array to determinate if the texture is the shape i want or not. is it possible to save the texture data to an array? here is the FBO class (i want to have renderTex[0] as array): public class FBO { int [] fb, renderTex; int texW; int texH; public FBO(int width,int height){ texW = width; texH = height; fb = new int[1]; renderTex= new int[1]; } public void setup(GL10 gl){ // generate ((GL11ExtensionPack)gl).glGenFramebuffersOES(1, fb, 0); gl.glEnable(GL10.GL_TEXTURE_2D); gl.glGenTextures(1, renderTex, 0);// generate texture gl.glBindTexture(GL10.GL_TEXTURE_2D, renderTex[0]); gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST); gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_NEAREST); gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_CLAMP_TO_EDGE); gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE); //texBuffer = ByteBuffer.allocateDirect(buf.length*4).order(ByteOrder.nativeOrder()).asIntBuffer(); //gl.glTexEnvf(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE,GL10.GL_MODULATE); gl.glTexImage2D(GL10.GL_TEXTURE_2D, 0, GL10.GL_RGBA, texW, texH, 0, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, null); gl.glDisable(GL10.GL_TEXTURE_2D); } public boolean RenderStart(GL10 gl){ Log.d("TextureAndFBO", ""+renderTex[0] + " And " +fb[0]); // Bind the framebuffer ((GL11ExtensionPack)gl).glBindFramebufferOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES, fb[0]); // specify texture as color attachment ((GL11ExtensionPack)gl).glFramebufferTexture2DOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES, GL11ExtensionPack.GL_COLOR_ATTACHMENT0_OES, GL10.GL_TEXTURE_2D, renderTex[0], 0); int error = gl.glGetError(); if (error != GL10.GL_NO_ERROR) { Log.d("err", "FIRST Background Load GLError: " + error+" "); } int status = ((GL11ExtensionPack)gl).glCheckFramebufferStatusOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES); if (status != GL11ExtensionPack.GL_FRAMEBUFFER_COMPLETE_OES) { Log.d("err", "SECOND Background Load GLError: " + status+" ");; return true; } gl.glClear(GL10.GL_COLOR_BUFFER_BIT); return true; } public void RenderEnd(GL10 gl){ ((GL11ExtensionPack)gl).glBindFramebufferOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES, 0); gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); gl.glEnable(GL10.GL_TEXTURE_2D); gl.glBindTexture(GL10.GL_TEXTURE_2D, 0); gl.glColor4f(1.0f,1.0f,1.0f,1.0f); gl.glDisable(GL10.GL_TEXTURE_2D); } public int getTexture(){ return renderTex[0]; } public int getFBO(){ return fb[0]; } }
  8. alireza.pir

    Comparing two textures in openGL

    thats not possible because the user may use different ways to achieve the final shape... 
  9. alireza.pir

    Comparing two textures in openGL

      here is some pictures of it (the dashed line is not drawn in opengl and is just a test image on top of opengl render space)      
  10. alireza.pir

    Comparing two textures in openGL

            i am making an origami like game and user folds the paper in 2D Space, i want to check if the final texture is what i wanted the user to make or not, i am using opengl 1!  does i need to upgrade to 2.0?! and if so, how to achieve this by that?
  11. I'm new to OpenGL, in my android game I'm looking for a way to compare two textures to tell me the similarity of two in percent value or in any other way! I know how to to this with two bitmap images but I really need to use a method to compare two textures. Question is: Is there any way to compare two textures as we compare two images? Like comparing two images pixel by pixel?  any resources? 
  12. alireza.pir

    OpenGL-keep track of texture shape

      Im trying to make an origami like game, and i want to know does the texture on the rectangle fits my Known shape or not, and rate the user if it does.   thanks for your reply, but i didn't get what should i do, could you please give me some link to get the way?
  13. I have a Rectangle with a texture bind to it like this: (black dashed line around the rectangle is Not drawn On the scene and i just draw it to show the rectangle which the texture is on It) I want to somehow keep track of this texture Polygon that is drawn on the rectangle.(the rest of texture except the blue part is transparent) and check if it fits a polygon that its vertices are Specified(For Example the white dashed shape) Should I Use Image Processing to achieve this? I want to do this dynamically because my texture on the rectangle changes every frame from FBO, so it shouldn't be Expensive. How can i do that? (Just an Idea of it)
  14. well there is no problem with the OpenGL Version, i even changed the OpenGL Version Used in my App But still same Problem. what should I do?
  15. I want to capture the rendered scene in my Android openGl App in A Texture Using FrameBuffer Object. EveryThing is Fine in the emulator, But on Real Device the frameBuffer Object wouldn't work, meaning Nothing Goes to my Texture, Here is the FBO Class (For Creating FrameBuffer and creating texture of it): public class FBO { int [] fb, renderTex; int [] TextureBank; int top; int texW; int texH; int maxTextures; public FBO(int width,int height,int maxTextures){ texW = width; texH = height; fb = new int[1]; renderTex= new int[1]; top=-1; this.maxTextures = maxTextures; TextureBank = new int[maxTextures]; } public void setup(GL10 gl){ // generate ((GL11ExtensionPack)gl).glGenFramebuffersOES(1, fb, 0); gl.glEnable(GL10.GL_TEXTURE_2D); gl.glGenTextures(1, renderTex, 0);// generate texture gl.glBindTexture(GL10.GL_TEXTURE_2D, renderTex[0]); gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST); gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_NEAREST); gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_CLAMP_TO_EDGE); gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE); //texBuffer = ByteBuffer.allocateDirect(buf.length*4).order(ByteOrder.nativeOrder()).asIntBuffer(); //gl.glTexEnvf(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE,GL10.GL_MODULATE); gl.glTexImage2D(GL10.GL_TEXTURE_2D, 0, GL10.GL_RGBA, texW, texH, 0, GL10.GL_RGBA, GL10.GL_FLOAT, null); gl.glDisable(GL10.GL_TEXTURE_2D); if(top>=maxTextures-1){ Log.e("OUT OF TEXTURE COUNTS", "OUT OF TEXTURE COUNTS Texture WIll Not Be added to Stack"); } else{ TextureBank [++top]= renderTex[0]; Log.d("TOP= ", "" + top); } } public boolean RenderStart(GL10 gl){ // Bind the framebuffer ((GL11ExtensionPack)gl).glBindFramebufferOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES, fb[0]); // specify texture as color attachment ((GL11ExtensionPack)gl).glFramebufferTexture2DOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES, GL11ExtensionPack.GL_COLOR_ATTACHMENT0_OES, GL10.GL_TEXTURE_2D, renderTex[0], 0); int error = gl.glGetError(); if (error != GL10.GL_NO_ERROR) { Log.d("err", "FIRST Background Load GLError: " + error+" "); } int status = ((GL11ExtensionPack)gl).glCheckFramebufferStatusOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES); if (status != GL11ExtensionPack.GL_FRAMEBUFFER_COMPLETE_OES) { Log.d("err", "SECOND Background Load GLError: " + status+" ");; return true; } gl.glClear(GL10.GL_COLOR_BUFFER_BIT); return true; } public void RenderEnd(GL10 gl){ ((GL11ExtensionPack)gl).glBindFramebufferOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES, 0); gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); gl.glEnable(GL10.GL_TEXTURE_2D); gl.glBindTexture(GL10.GL_TEXTURE_2D, 0); gl.glColor4f(1,1,1,1); gl.glDisable(GL10.GL_TEXTURE_2D); } public int getTexture(){ return renderTex[0]; } } And here is my OnDrawFrame Method Which uses this FBO: public synchronized void onDrawFrame(GL10 gl) { mObserver.onDrawFrame(); gl.glClearColor(Color.red(mBackgroundColor) / 255f, Color.green(mBackgroundColor) / 255f, Color.blue(mBackgroundColor) / 255f, Color.alpha(mBackgroundColor) / 255f); gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); gl.glLoadIdentity(); if(capture){ if(AttachTexture){ int h = gl.glGetError(); /** Setup FBO */ frameBuffer.setup(gl); if(h!=0){ Log.d("ERROR", "ERROR Happend"+h+""); } AttachTexture = false; } /** Start Rendering In FBO */ frameBuffer.RenderStart(gl); if (USE_PERSPECTIVE_PROJECTION) { double x = mCurlMesh.GetMinX()* mCurlMesh.GetMinY(); gl.glTranslatef((float)(-1.000-mCurlMesh.GetMinX()),(float)(-1.000-mCurlMesh.GetMinY()), -6f); } gl.glMatrixMode(GL10.GL_PROJECTION); gl.glLoadIdentity(); GLU.gluOrtho2D(gl, (float)mCurlMesh.GetMinX(), (float)mCurlMesh.GetMaxX(), (float)mCurlMesh.GetMinY(), (float)mCurlMesh.GetMaxY()); gl.glMatrixMode(GL10.GL_MODELVIEW); gl.glLoadIdentity(); gl.glViewport(0, 0,texW,texH); mCurlMesh.onDrawFrame(gl); /** End Rendering In FBO */ frameBuffer.RenderEnd(gl); } //Reset Every Thing to Its Normal State gl.glMatrixMode(GL10.GL_PROJECTION); gl.glLoadIdentity(); GLU.gluOrtho2D(gl, -1.1f,1.1f,-1.1f, 1.1f); gl.glMatrixMode(GL10.GL_MODELVIEW); gl.glLoadIdentity(); gl.glViewport(0, 0, mViewportWidth, mViewportHeight); mCurlMesh.onDrawFrame(gl); } I Should mention that my Texture size IS 2^n: frameBuffer = new FBO(1024, 1024, 8);
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!