Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

116 Neutral

About EasyCoder

  • Rank
  1. I have spent on this problem now over a week, took the whole class apart, modified, changed parameters, removed bits which I thought could cause the problem... No improvement. Re-sampled all sounds to the lowest sampling rate possible... No improvement either.   I am getting really fed up with this problem and starting to think I might dump the whole unreliable SoundPool and replace it with some other way of playing sounds...   Does anybody have any suggestions as to what is the best and most reliable way of playing sounds in Android? (not music - short sound effects).
  2.   It happens immediately after start of the app, when I attempt to play the first sound.
  3. In my Android game, I am playing short sound effects using AudioManager and SoundPool.   While this works fine on Samsung Galaxy Tab 10.1, when I ported the game to Samsung Galaxy SIII, I am experiencing strange lock-ups of the screen and crashes of the application with re-booting of the phone, when I am trying to play the sound from the SoundPool.   It behaves quite erratically and one of 4 things happen (in no particular order):   (1) Application starts as normal and all sounds play normally.   (2) Application crashes completely and mobile reboots.   (3) Application freezes shortly (3-5 seconds) upon trying to play the sound, then continues normally, but sounds don't work.   (4) Application starts as normal, but none of the sounds plays. *   * There is a strange twist to the 4th case. None of the sounds plays, but when I activate game background music (which plays via MediaPlayer, not via AudioManager/SoundPool) this somehow 'flushes down' the stuck sound effects which should play at the beginning of the game, and now they all catch-up and play at once. This 'flushing down' somehow returns everything back to normal and from this point on all the sound effects from the SoundPool play normally, as they should.   The error which I am getting is:   AudioTrack: obtainBuffer timed out (is the CPU pegged?) "CPU pegged" what the hell does it even mean ???   Note that the problems happen at the point in the game when I am attempting to play the sounds from the soundpool by SoundPool.play, not when I am loading them by SoundPool.load.   I tried just about everything and now I am at the end of my wits. Did anybody have the same problem? Any help is highly appreciated.    
  4. EasyCoder

    glRotatef behaves strange

    Cool - so then this topic can be closed
  5. EasyCoder

    glRotatef behaves strange

    Yes, your explanation makes perfect sense to me. And gluOrtho2D works like a charm ! Now all 15 objects rotate exactly at the same angle. Thanks for your help & suggestion. Only one more question: can you swap back and forth between gluOrtho2D and gluPerspective within the onDrawFrame ? This is for a game which I am developing, and the engine is already finished and working fine in gluPerspective, so I am not very keen to change it to gluOrtho2D. I just want to do that rotation effect in gluOrtho2D, then get rid of the objects and swap back to gluPerspective. Is this possible ?
  6. EasyCoder

    glRotatef behaves strange

    I see. Is there any way to change the perspective, so they all appear the same ?
  7. EasyCoder

    glRotatef behaves strange

    [attachment=10267:glRotatef-y.jpg] So this is how it looks like, when I use the above code. I am using GL_MODELVIEW in glMatrixMode and fovy (field of view angle in y direction) in gluPerspective is set to 45.0f. Could it have anything to do with fovy, as it is also in y direction ?
  8. EasyCoder

    glRotatef behaves strange

    This is how the code looks like: while (column <= 15) { gl.glLoadIdentity(); gl.glPushMatrix(); gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA); gl.glEnable(GL10.GL_BLEND); gl.glTranslatef(column, row, -5.0f); gl.glRotatef(45.0f, 0.0f, 1.0f, 0.0f); gl.glScalef(0.25f, 0.25f, 0.0f); object.draw(gl, bitmap_index); gl.glPopMatrix(); } The 15 objects are identical 2D squares with the same bitmap mapped on them.
  9. EasyCoder

    glRotatef behaves strange

    No, you did not get me - it is not happening on all the axes - that is the weird thing. Of course I meant it is not happening when I rotate around those two axes, i.e. when I use: gl.glRotatef(45.0f, 1.0f, 0.0f, 0.0f) or gl.glRotatef(45.0f, 0.0f, 0.0f, 1.0f) All 15 objects rotate at the same angle, no accumulation there. And the code is the very same - that is what confuses me.
  10. EasyCoder

    glRotatef behaves strange

    I of course use glLoadIdentity as well as glPushMatrix & glPopMatrix. [/quote] Yes, after some experimenting I found that the rotations really ad up. I started with glRotatef(45.0f, 0.0f, 1.0f, 0.0f) and I got objects on the right side of the screen rotated the most and on left side the least (just what would you expect if the rotations gradually add up) Just to confirm that, I then tried gl.glRotatef(675.0f, 0.0f, 1.0f, 0.0f) (as I have 15 objects => 15 * 45 = 675) and lo and behold, now it was opposite - i.e. objects on the left side of the screen were rotated the most and on right side the least !!! So that is clear. Now there are just 2 questions remaining: 1) Why is this not happening with x or z axis, only with y ?!? 2) How to avoid this adding-up of rotation ?
  11. EasyCoder

    glRotatef behaves strange

    I of course use glLoadIdentity as well as glPushMatrix & glPopMatrix.
  12. I have several 2D objects (simple squares with bitmaps on them) which I need to rotate on y axis (i.e. from left to right) all at the same angle. However, when I use glRotatef command, the objects on the right side of the screen are rotated the most, and progressively towards the left side of the screen, they rotate less and less. If I have let say 15 objects side-by-side, the difference in rotation between the leftmost and rightmost object is quite substantial and clearly visible. I assume this is something to do with the perspective, but cannot figure out what I am doing wrong. Just for interest, if I rotate the same objects on x axis (i.e. from forward to backward) the angle is the same for all of them ! Anybody knows how to achieve rotation at the same angle for all the objects on y axis ? Thanks in advance for any suggestions.
  13. I have tried all combinations of GL_CLAMP_TO_EDGE and GL_REPEAT for S and T coordinates without any change. But thanks for pointing me in this direction, because I have looked on the tutorial where I took some of the code from, again and found this comment by someone: I was trying to implement a similar functionality using glDrawArrays. However, I’m unable to get it running on Android. I’m trying port an existing iPhone application to Android. The same openGL code works fine on iPhone. I am also using glDrawArrays, so I suspect this will be the root of my problem. I will try replacing glDrawArrays with glDrawElements and see if that makes any difference.
  14. I am returning to this problem after long time as I still haven't quite cracked it. I already thought I have figured it out. When I gradually increase roll variable, texture nicely rolls over the object (square) as desired. float[] texCoords = { 0.0f, 1.0f + roll, // A - left-bottom 1.0f, 1.0f + roll, // B - right-bottom 0.0f, 0.0f + roll, // C - left-top 1.0f, 0.0f + roll // D - right-top }; However, only in the emulator (on Eclipse). If I run the same code on the actual device, the texture does not roll continuously over the square (what I am trying to achieve), but scrolls of the square gradually completely until it disappears. For better understanding, instead of desired effect: from this: 000XX000 00X00X00 0X0000X0 X000000X to this: 00X00X00 0X0000X0 X000000X 000XX000 I get: 00X00X00 0X0000X0 X000000X X000000X then: 0X0000X0 X000000X X000000X X000000X then: X000000X X000000X X000000X X000000X Basically, I get scrolling, instead of rolling I suspect it is something in the way how I am wrapping the texture over the square, but I cannot figure out what parameter I have to change to get the desired rolling effect. Anybody has tried this already before and knows how to achieve the rolling of the texture over the square ? What I am trying to achieve is that the topmost line of pixels will be removed, all lines will be shifted 1 pixel up, and the topmost line of pixels will be added at the very bottom, etc, etc... until the texture ends up in original state, and then the whole process starts again. Thanks for any help.
  15. Of course !!! Sometime you are looking for a solution and cannot see that which is right under your nose. It is because I program in Android / Java environment only a couple of months and still cannot get used to some of its quirks. I am now loading the level-dependent bitmaps via functions in Activity, but I am calling these from my main game loop which is in onDrawFrame. I did not use your approach of writing the dedicated class for handling the bitmaps (though it may be neater solution) as my game is now 99% finished and this would mean substantial rewriting of everything and further delays with finishing the game. Application still struggles at the startup, going as low as 1% of the available memory (as in above log), but then recovers and increases to some 74% - that with 95% of all bitmaps required for the game already in. I am a bit concerned about this startup struggling, but I have run it yesterday about 50 times on the actual device and it did not go OOM a single time, so I guess this is some inherent feature of Android. Thank you for all your help and patience Fiallen !
  • 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!