Venerable Vampire

  • Content count

  • Joined

  • Last visited

Community Reputation

151 Neutral

About Venerable Vampire

  • Rank
  1. Projection in the middle of View

    The way you are doing it, which is fairly consistent with the way OpenGL works, has the point at 0,0,0 in 3d space being translated to the center of the screen. What you need is for an object to be shifted out of the screen by a number of units along the z axis so as to make it appear. There is no easy formulaic thing for determining a 'correct' distance because you usually don't want it to be based on that but on user input instead (games, 3d modellers, etc.). Just pick your projection value and fiddle with z values untill it looks right. On another note, your projection distance can be calculated from the screen width and the field of view you want. projection_distance = width/2/tan(field_of_view/2); Note that tan is a trig function, and is usually in radians.
  2. why won't this work??

    I assue from the private static final thingy you are in Java, so I have two things. 1. private static final int The keyword "final" there indicates that the variable cannot be changed after initialization. So you usually give it a value in the same statement as the declaration, as in your first (working) example. 2. outside of methods variable declarations are permitted, but assignments are not. So: private static final int GAME_STATE_INTRO = 0; is perfectly valid outside of a method. While: GAME_STATE_INTRO = 0; is not, unless you did that in main, but then a conflict might arise over the final keyword, not sure.
  3. Pong help

    I agree with the people above me, and I must recommand that you do two things, in order: 1. put pong on hold for a little while. If you really are just that new to programming, you don't want to consider graphics yet, much less user interaction or animation! Learn your language. You mentioned C. C is a great language, go find websites about it. Learn all you can about it untill you really think you can do it. I learned Java to quickly and was frustrated for about 6 months where I did little to no coding. Don't do that! 2. Get something like Allegro or SDL. You said simple, but those are about as simple of graphics as you can possibly get. I haven't used Allegro, but I know SDL does everything for you and lets you do graphics, user-interaction, and animation with little to no trouble. Learn how to do some kind of simple demo with each of those first, then try pong. 3. Have fun!
  4. Engine of Colin McRae Rally

    I also would not like to start a flame war, but how can you even suggest that Micro$oft would even think of PORTING DIRECTX. It's like a staple of windows.
  5. What are you using? GLUT - glutSetCursor(GLUT_CURSOR_NONE); <--- maybe, not sure SDL - SDL_ShowCursor(false);
  6. moving problems.

    OK in SDL when you press a key the key pressed event that is generated only occurs once, and the released event also only occurs once. You can't just poll the loop to see if the key was held. Suggestion: Make an array of boolean variables, like 256 or 512 in size. When a key is pressed, set the boolean with that key value to true, and released set it to false. So every loop when you need to move something or check a key press, check the array and not the actual event queue.
  7. Any explanations for this.

    In OpenGL near plane values of less than 1 can cause artifacts. Just use 1 if you can.
  8. Problem rendering colored spheres on Mac

    java stuff works exactly the same on every platform supported, mac included. The problem is most likely that the Java3D library is not installed, or not installed correctly. I haven't used Java3D much, or recently, but it may be that a special linkage needs to be used. Specifically what kind of problems are you having?
  9. Java Engine

    Definantly an application. As an applet you can't get total control of the screen or some other stuff that really allows for a fully-imersive demo/game/thingy. If you want to impress your teacher/classmates make a simple 3d game or rotating (fill in cool shape). Or a wave simulation.
  10. vector versus array - a race

    you're thinking of lists, like linked list in the 'list' class. Those are much more 'dynamic' that just straight arrays, but usually you don't need all that and it is better to use vectors because it's just as fast to access in the middle as it is to increment along it.
  11. How to deconstruct a game...?

    c compilers can usually give you the assembly source for a particular source file. I think the *nix syntax is somthing along the lines of: gcc myfile.c -S and returns a file myfile.s or something
  12. problem with exercise in C++ book

    kbhit is a command that checks to see if a keyboard key was pressed, and maybe returns the value (it's not cross platform so I've never used it). A slightly better (more cross platform) solution might be to use getchar() until the char is a new line ('\n'). That way it'll pause until you get the return or enter key's pressed. An even better solution would be to not worry about it until you get into the really fun stuff, like graphics with SDL, Allegro, even GLUT (shudders). Have Fun!
  13. how would i go about doing this (java)

    Quote:Original post by lucinpub That is the sign of a very poor design. If this is your project and not just some exercises from a book or something, you need to rethink the design of your system. When only considering "good" code verses "bad" code, I agree 100%. That being said I have written a Sokoban Clone (In Java) where virtually every class was connected to it's "owner" (the main class) to retrieve data to perform calculations. It was easier than passing a bunch of variables for every function call. The game worked, and I might still have it.
  14. how would i go about doing this (java)

    When you are passing classes in Java, what you are really passing is the POINTER to the class. So when you initialize A first, with the argument of B, A gets a null pointer in whatever variable should hold the reference to B, which is bad. So instead do something like this. ClassA myClassA = new ClassA(); ClassB myClassB = new ClassB(); myClassA.setInstance(myClassB); myClassB.setInstance(myClassA); With each class having a member variable of the other's type, and the setInstance function setting that variable to the value passed. That should work.
  15. Learning Experiment

    I have been reading some articles about parsing/compiling programs and I decided to try my hand at writing an interpreter of my own. I made a little calculator similar to some lex/yacc examples out there, but without the lex/yacc, just as a learning experience. If anyone cares to read through the source and point out glaring errors I would be quite thankful. I plan to eventually write a toy language without the aid of lex/yacc so I need to understand this stuff. source