• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

498 Neutral

About Fahrenheit451

  • Rank
    Advanced Member
  1. [java] Volume control for bgm vs effects

    Think I have figured this out. Not as elegant as it could be with plenty of opportunity to refactor later on and come up with a better strategy overall. Seems I need to use the MASTER_GAIN FloatControl type and not the VOLUME type for controlling volume. For each sound clip instantiated I call the getControl method for the MASTER_GAIN control type and set the gain accordingly. Requires some thought when you hook that up to a slider control, since gain is handled differently than a regular volume, but on the whole it works. F451
  2. Hi all, I recently started using Java at work, so as a home project I wrote a tic-tac-toe game for my kids. I have added sound effects (burps, farts etc - the typical things a 6 year old boy wants to hear in a game :-) and a track he likes as the background music. I have added two slider controls for controlling the volumes of the background music and the effects, but can't seem to find a way to program this so each volume control affects only the sound it is supposed to. The volume control routines I find on the web control the volume of all sounds - almost like controlling the system volume. Does anyone have any experience or advice on how to go about this? These are WAV files, loaded with AudioStreamInput passed to AudioClip objects. Like I said, new to Java so I might be going about this the wrong way entirely! Thanks everyone.
  3. World Cup 2010

    Quote:Original post by phantom USA should make it to the next round; them and England are clearly the strongest teams (on paper at least) in that group. Right. The question is who is going to go top... because the runner up in group C are set to play the winner of group D in the next round, and the winner of group D is likely to be Germany. England had better hope they come in top as their route to the semi's could be a lot easier. F451
  4. Where to get used RAM?

    I don't know about your area, but here I have to go to the public works recycling center once a week to drop off bottles, cans, and cardboard (the tight basterds my township doesn't even collect trash), but there are always old computers down there which might have what you're looking for. Go armed with a screwdriver and ask permission. Hey, you might even get a summer job there :-)
  5. Trying to include OpenGL

    Hi. I went through this just the other day. I had to do the follwing; 1. Download the GLee package an unpack in a temporary folder. 2. Move the GLee.h file into the include\gl folder, and the GLee.lib into the lib folder of your Platform SDK and windows SDK installations. For me this was; C:\Program Files\Microsoft Platform SDK\include | lib C:\Program Files\Microsoft SDKs\Windows\v7.0a\include | lib These will be different depending upon which SDK's you have installed and upon the IDE you are using and its configuration. Check the setting of your IDE and/or project to determine which are being used, or you could brute force this and use a file find/search and find all of the places gl.h exists :) 3. In your project you will need to add the GLee.lib along side opengl32.lib and glu.lib so the linker can resolve. 4. Finally, you have to have the right includes in your headers otherwise you still continue to get errors. I was down to one which said "gl.h was found before glee.h", which meant I had to search every header for gl.h includes and remove them. In my main program cpp file I put #include <gl\GLee.h> and following that #include <gl\glu.h>. That was all. As MatthewS said, no need to gl.h to be included. Occasionally a header required a <gl\GLee.h>. Depending upon how well structured your headers and cpp files are you might or might not be engaged in a little cleanup. HTH F541
  6. My Quaternion based Camera Zooms by itself?

    YES Molle85! Because he wants to! Programmers should, by nature, be curious creatures. Are you not blessed with the most blessed of traits called curiosity, to dig and delve into the inner workings of the machine, to conquor with code, and to feel the thrill of achievement over coding challenges - whether those are self-imposed and often times "re-invent" the wheel? Surely you have felt this, and like everyone else here, you have probably wrote a routine or two in your past that was "already out there" and could be lifted from a library. I have wrote many, and continue to develop many that could easily be solved by simply adopting D3DX or Boost. Whether or not that makes a better programmer is debatable, but I firmly believe better programmers come from discovery. "Rolling your own" is at the very heart of this trade, and its important to not stifle, critisize, question, or attempting to put down this worthiest of goals. We might, by way of virtue or experience, point others in alternative directions, but *only* after we have offered advice and answered to the best of our abilities, and offered others the benefit of our experience, otherwise simply, to coin a phrase, STFU! Now, if he was working for me in a commercial environment where productivity reigns, then I would of course slap him around the head and tell him to stop re-inventing the wheel and us a library :) F451
  7. Need some bad game ideas...

    A variation on Moe's collecting idea. The Man Shelf game. This is a game of timed activities. Stage One The first stage is to run around a giant "Home Depot"-like superstore and gather the necessary items to put up your self.Typical obstables in this stage are non-existant shop staff to help you. Staff that seem to randomly send you to the wrong isle or give you complete bullcrap advice on what you need to complete the task, and customers who actually think you are staff because you are wearing your favourite orange pants. Additionally you only have $8.75 in your pocket. Stage Two Put up your shelf. Another timed activity. This is made easier if you did exceptionally well on the first stage and managed to find all the right items at the right price and managed to get a spirit level with your budget. Points are awarded for level-ness of the shelf and the number of screws used. Points are deducted for screws hitting a stud when you used an anchor, or hitting a water pipe or electrical cable (randomly distributed throughout the wall). A stud finder would be an ideal addition to your kit, but are cleverly hidden throughout the store in stage one, so great if you found that where it isn't supposed to be. Final Stage The final stage is the most difficult. Here you have to visit numerous locations to gather the recommeded items for your man shelf. A complex algorithm runs when you have placed 10 items you think suitable for the shelf, and points are awarded when the algorithm finds these items in a super database of all items that exist (yet to be built). If you get the high score from all the competing man-shelf building real men on the internet. You are the winnar! Disclaimer1: Probably need an hour to explain this particular game due to the complexities involved. Disclaimer2: Stage one is in no way a reflection on the real Home Depot, which I do not shop at but I believe has an excellent reputation for a being "the helpful place". Or is that Lowes?
  8. OpenGL How to prevent showing a grid?

    Check OpenGL Common Mistakes, and check the bit about clamping "10. Texture edge color problem". It explains one reason why people see black borders. HTH F451
  9. OpenGL Lighting with GL_TRIANGLE_STRIP

    Looking at the triangle strip image you are not rendering that many polygons to bring the frame rate down. I would bet your low frame rate is a result of doing something in the main draw scene routine that you shouldn't be doing - like constantly reloading the map, recalculating the normals etc. These can be done once up front and then just referred to in the draw scene routine (which you appear to be doing for the most part, so just check the main draw scene routine for something unecessary). The way in which you render the terrain - quads, individual polygons, triangle strips etc, should not affect the end result as much as the particular way in which you calculate the normals (say per quad, polgon, or per vertex, which is best).ie. The more effort you can put into getting a good normal value for each vertex, the better your scene will look. As long as the normals are calculated correctly (beforehand) and are accessed appropriately by the type of render method in use, then you should see consistent results with any render method. I would bet your triangle strip approach is not accessing the right normals for the particular polygon being rendered. Hope that helps F451
  10. SDL or Boost for Timing?

    I guess accuracy is somewhat subjective. Both make use of what the system provides, which is really just access to a millisecond timer. From that you can generate values in any scale - nano, micro/milli, seconds, minutes, hours etc. Also, depending upon how your own program is written, the functions you call, actions you perform etc, will also affect how frequently you can make the calls to get the tick updates. With SDL you will have to do some coding yourself to generate timing data. Boost will have done more for you. Both will deliver what you want, one with more work than the other, and you decide the precision by which to represent the timing data. If you are already using SDL then use the GetTicks function to return a milliseconds value (milliseconds since your SDL initialization if I recall correctly) that can be used to calculate an interval for example, which in turn can be represented in nano, micro, milli, seconds, minutes etc. If you are already using Boost then use that to do the same. Advantage is that Boost has already encapsulated all of those calculations in library and saves you writing it for the most part. Then again, if you are not using SDL or Boost already, then write your own timer class. Simple enough to write and there are plenty of tutorials on the web, and it would give you an understanding of how the internals work. My point is that it might not be worth it to go Boost or SDL for just that one piece of functionality. If you do go Boost or SDL, then probably better to plan a more wholesale use of the library. F451 [Edited by - Fahrenheit451 on February 26, 2010 9:40:36 AM]
  11. Hi ElPeque2. Did you look at TGA's? When compressed they are a good compromise between png and jpeg, and are very popular.
  12. Displaying Command Keys on Screen

    I use these // // Change to 2D mode (orthogrphic mode) // void SwitchTo2D() { // switch to and reset projection matrix glMatrixMode(GL_PROJECTION); glLoadIdentity(); // switch to orthographic mode, with 0,0 being lower left glOrtho(0.0,(double)SCREEN_WIDTH,0.0,(double)SCREEN_HEIGHT,-1.0,1.0); // switch back to modelview matrix and reset glMatrixMode(GL_MODELVIEW); glLoadIdentity(); // disable depth test in 2D glDisable(GL_DEPTH_TEST); } // // Change to 3D mode (projection) // void SwitchTo3D() { // switch to and reset projection matrix glMatrixMode(GL_PROJECTION); glLoadIdentity(); // disable depth testing glEnable(GL_DEPTH_TEST); // set our field of view gluPerspective(45.0f,(double)SCREEN_WIDTH/(double)SCREEN_HEIGHT,1.0,500.0); // switch to and reset the model view matrix glMatrixMode(GL_MODELVIEW); glLoadIdentity(); } so my draw routine does something like int DrawGLScene(GLvoid) { SwitchTo3D(); . . do my 3D drawing . . glDisable(lighting, textures etc) . SwitchTo2D(); . print my text . return true; } F451
  13. Displaying Command Keys on Screen

    Hi esroh. This type of text is best presented in orthographic (2D) mode, which makes it like an overlay on the screen. If the scene you have created is in perspective (3D) mode, then at the end of drawing your scene you need to switch momentarily to 2D mode, switch off any texturing and lighting, and display your text. This is quite a common technique. You can find good examples of this all over the place, but I recommend studying the NeHe examples, which will introduce the concept of building a font and displaying the text. I think from lesson 13 onwards starts with bitmap fonts, which is probably a good place to start. You will see other types of font building techniques, such as texture mapped fonts, but start with bitmap. http://nehe.gamedev.net/ Let me know if you want a couple of general purpose 3D-2D mode switching routines and I will paste them up. hth F451
  14. Depth Problem

    Try changing the glPolygonMode(GL_FRONT,GL_FILL); call to fill both front and the back of the polygon. ie. glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); Just a guess as there is not enough information in your description and I can not run your code. hth F451
  15. OpenGL Positioning text.

    Hi arimaKun. Placing text into a 3D scene is easy enough, like in this tutorial, but when you begin to perform window resizing or camera movement you should expect things to start shifting around. As you are probably aware, your program sets up a the OpenGL scene in perspective (3D) mode, which means you are working with units of measurement along three axis in space. It is mighty hard to get text to be constantly hanging in front of the camera in a fixed position and scaled to meet the screen resolution. Think about the positioning statement glRasterPos2f(-0.55f, 0.39f). If the camera has changed or the screen resolution changed, then that translation of -0.55 units can look entirely different now. For example, if the camera has moved out from the scene then the move would look smaller than if the camera had moved closer to the translation point. If the resolution was made smaller then everything might be off the screen as the translation of -0.55 units would be a big jump. This is why the text is shifting around. To make life much much easier for yourself, you should "overlay" your text onto the 3D scene if you want it fixed or positioned and scaled according to the screen resolution. This requires you to switch to orthographic (2D) mode and work directly with the screen in pixels. You can then always fix a position much easier. For example, assuming the top left is (0,0) you could always position the text 10% in from the left and 10% down from the top by multiplying the width and height resolution values by .1 to give you the pixel offset you want in your positioning and also work out a scale value for sizing the text to be always a fixed percentage of the screen height. A little googling for "glut orthographic" came up with a link to the great Lighthouse site on glut. The tutorials probably build on one another so you might need to research some others. Also run a search on gamedev for OpenGL perspective and orthographic modes so you can familiarise yourself with the idea of overlaying things in OpenGL. http://www.lighthouse3d.com/opengl/glut/index.php?bmpfontortho Hope that helps. Let me know if you have any more questions. F451
  • Advertisement