Tag Info

Hot answers tagged

4

What you are looking for can be found in this very good explanation: http://www.songho.ca/opengl/gl_transform.html But since I found it sort of confusing without hand holding I will try to explain it here. At this point you need to consider 5 coordinate systems and how they relate to each other. These are the window coordinates, the normalized device ...


4

Java defaults to using GDI (AWT, Swing). JavaFX supposedly will be able to make use of OpenGL in future. Java + LWJGL (an OpenGL wrapper that accesses native opengl32.dll via JNI) provides more direct hardware-accelerated support for Java. Flash Player 11 onward made use of OpenGL via Stage3D. Without using Stage3D, it is using a software renderer built to ...


3

Nick already gave a more specific answer, but I get the sense from your question that you'd benefit from a more generic answer. Different platforms have various ways of getting pixels to the screen. Software is written in layers. You can implement OpenGL on top of D3D (like Microsoft has done), or even on top of GDI as software rendering (like Microsoft ...


2

Do not have a client talk to a database server. The client talks only to the frontend game server, and nothing else. That server then distributes client requests to the appropriate backend server. The frontend servers and (most) of all the other servers are distributed geographically. Not distributing the front-end server as in your diagram defeats almost ...


2

You should be able to use glViewport() to limit rendering to a specific portion of the screen. Just keep in mind that you might have to adjust your matrixes as well. In C++, the call would be as simple as this: glViewport(left, top, width, height); You should find a wrapper for this in LWJGL as well. glScissor() would be another alternative if you don't ...


2

Read the wiki! Controllers connects/disconnects don't give listener events (right now), so controllers must be polled manually. The wiki says controller listeners don't work on the desktop for connects or disconnects. I'm no expert, I've just been reading the wiki in detail, but it looks to me like you must poll the controllers manually. This code will ...


2

This is more of a design decision, since objects are implicitly references in Java, so it really doesn't make much difference to be copying an extra reference. I'd suggest you just do whatever works first and then, if you feel you need to, start to optimise/change things and see if you get a better result. That's the best way to learn.


1

I am not incredibly familiar with mobile interface processing but my understanding of your question is that you want the user to be pressing both up and left at the same time on the device? This seems to be a little counter intuitive, while on a computer it is natural to press two keys at a time but for a mobile device you would only want to press once. My ...


1

You need to change OpenGL's projection matrix so that it will change the area of the world that is drawn within your window. The projection matrix is what OpenGL uses to determine how the world will be projected onto the screen. Most likely, you're setting this in the beginning of your program to say "draw the area of the world from (0,0) to (800,600)." ...


1

First, when are you calling the jump() method? Make sure it really gets called, maybe by using a log message. Second, instead of body.setLinearVelocity(new Vector2(body.getLinearVelocity().x, 12)); you should do body.setApplyForce(new Vector2(0, 120)); Setting a velocity directly is frowned upon and should be done only in a few exceptional cases such ...


1

Collision callbacks are explained in http://www.bulletphysics.org/mediawiki-1.5.8/index.php?title=Collision_Callbacks_and_Triggers. This translates quite straightforward to JBullet. However if you have already tried and failed to follow that, I'll just provide the code I have been using myself. First set-up a callback that is called on every physics ...


1

Keep rendering the game. just pause the logic! You can esily just attach a "pause" pass, that will render the framebuffer and then blur it or what not, and after that add some gui! should be really straight forward. The only reason i can imagine why you would like to take a screenshot is to not use all the gpu power and reduce lag when you are pausing. ...


1

Well what I do for my 2D game is that inside of checking before the players moves, I deal with collision after the player moves. Before I used to run into problems like yours because of the fact that when you check before hand, you stop the player from moving. Heres what you have to do, lets say that there is a block at some x, y, width and height ...


1

I finally got it !! package com.Main; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Screen; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.GLCommon; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; import ...


1

If you want to use swing, you have to run it on the EDT, so option wouldn't work. As you mentioned any long-running stuff should'nt be on the EDT and any minecraft-like game would be pretty intensive so that makes option 3 the best one. Just make sure that everything in the logic thread is threadsafe and that you use invokeLater() to do anything on the ...


1

Unsure if you found an answer, but for anyone else who came here looking for one: Setting Gdx.input.setInputProcessor(stage) basically means the stage is getting all input signals. So to get your events to fire, you need to change buttonPlay.addListener(new InputListener() to stage.addListener(new InputListener() and do that for the rest of your ...


1

Until OpenGL 3.0, each version of OpenGL was a direct superset of the previous one, so as long as a graphics card and its drivers support the functions you use, you don't have to worry about compatibility. Also, until 3.0 was released, there was no way to choose an OpenGL version because if you got a newer version than you wanted, you just got functionality ...


1

I finally figured out how to use a matrix to do transformation on lines in Android. It's a little roundabout but hope it helps someone. The following code is to rotate a line around it's center. //coordinates of line (x1,y1) to (x2,y2) float x1,y1,x2,y2; //get the center of the line float centerX = Math.abs((x1+x2)/2); float centerY = Math.abs(y1+y2)/2; ...


1

You should probably use texture regions. With texture regions you can select a sprite, doesn't necessarily have to be a sprite in your case, and slice it up in parts to be reused. As example: int numOfTiles_Horizontal = 3;//Can be any size as long as it lines up with the texture size. int numOfTiles_Vertical = 3;//Can be any size as long as it lines up ...


1

Probably the frequency of the noise is too high. You can control the frequency by scaling the input to the noise function: float height = (float) PerlinNoise.noise(frequency * (x+offsetX), 0); You can then tweak the value as desired. Lower frequencies will produce smoother terrain, with a larger horizontal scale for the bumps. You can then adjust the ...


1

Trust me look into Scene2D. It handles everything input related for you. You can even do timed based actions on it, which are very nice. Its also built into libGDX. Truuuuust me its super easy once you get the hang of it. Honestly, I now write everything in Scene2D. If your having issues getting started with it, Heres a little sample code for you Stage ...


1

Your Drawing constructor checks flag and starts or stops the timer. However, the only code (that you've shown) that could ever set flag is in the keyPressed callback. keyPressed is called when a key is pressed, and will modify flag appropriately, but no code will ever check flag again. The Drawing constructor already ran to completion, so unless there is ...


1

There are several steps you need to follow that will allow you to pick in a 3D application. To transform screen coordinates to world space coordinates, you need to denormalize the scree-space coordinates. Then, you need to multiply the the point of the cursor (assumed object doing the picking) in normalized device space with this matrix. Then we would ...


1

This really depends on two things. One - Is your box axially aligned? (ie. Is there a face pointing up, down, left, right, forward and back, or is it rotated ?) Two - Are your points at all sorted? If you are using an axially aligned box, you can skip this first step. Work out a Quaternion which defines the rotation of the box. From now on, when I refer ...


1

Why don't you create a class for your coin object, and then collect all the coins in an array (Sprite[] coin), so whenever a collision occurs (player-coin), you call coins[i].destroy, where you can properly dispose all the referenced resources, or reset position for the next coin ? For drawing : for (int i = 0; i <= quantity of coins; i++) { ...



Only top voted, non community-wiki answers of a minimum length are eligible