Tag Info

New answers tagged

1

Texture must be a square with measurements of an exponent of two (16, 32, 64, 128, etc...), so re-size the file to one of those. I tend to use 1024 X 1024 for item textures. Otherwise LWJGL gets all messed up and the texture 'bleeds.'


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

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 ...


0

you can try drawing with a clipping mask, you could have a rectangle (or even irregular shapes) for the mask that represents that space. looks like LWJGL has that functionality (https://github.com/mattdesl/lwjgl-basics/wiki/LibGDX-Masking). however if you want to make some kind of minimap i think @Mario sugestion is more appropriate.


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 ...


0

Firs things first, The texture coordinates are probably not that what you want. You probably want 0, 0, 0, 1, 1, 0, 1, 1 with a size of 2. Further you are using glVertexPointer and glTexCoordPointer with the value vertexSize, it is unclear what that is. It is probably 3 or the code would not render. Ensure that this is the number of values per vertex. The ...


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 ...


0

The last input in the function is the problem. If you look at the lwjgl source code you can see that it uses it as an offset (used with PBOs). To actually pass no data use a 'null' instead.


0

The code you are using to switch between 2D and 3D seems OK. Your problem should be on the GL states. Usually, when rendering sprites and 2D GUI, I use the following states: glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); glDisable(GL_CULL_FACE); glDisable(GL_DEPTH_TEST); Then when switching back to 3D, I normally set: ...


0

Interleaved VBOs Let's assume you have vertices V_1, V_2, ... V_i each having position p and normal n. Positions and normals are called vertex attributes. Vertex attributes can be stored in an array, e.g. positions = {p_1, p_2, ..., p_i} and normals = {n_1, n_2, ..., n_i}. If you feed these arrays to OpenGL, you are using non-interleaved VBOs. You can also ...



Top 50 recent answers are included