lwjgl

Taskbar icon with lwjgl?

不想你离开。 提交于 2019-12-06 05:54:35
问题 I want to add a taskbar icon for my running lwjgl process on Windows 7. Display.setIcon changes successfully the icon in the topleft of the window, but not in the taskbar. What do to? My code, something like: ArrayList byteBuffers = new ArrayList(); byteBuffers.add( ImageHelper.loadImageAsIconImage("stickmanicon32x32.png") ); byteBuffers.add( ImageHelper.loadImageAsIconImage("stickmanicon16x16.png") ); System.out.println( "taskbaricon result: " + Display.setIcon(byteBuffers.toArray(new

How do I stream audio into OpenAL Sources?

醉酒当歌 提交于 2019-12-06 05:22:24
I've just began working with OpenAL. I've successfully loaded in WAV files into it, and played them successfully. It was easy enough. Now, I need to be able to stream music into OpenAL rather than loading entire files into it. While this is good for sound effects and the like, it can be very dangerous to do with music, as you probably know. The problem is, I cannot seem to find anything on Google related to this. While I have found some examples related to streaming OGG files, I'd much rather make a system that supports all music files. From what I understand, OpenAL should have built in

Enable anti-aliasing with lwjgl

妖精的绣舞 提交于 2019-12-06 01:42:35
I'm running this lwjgl application: Display.setDisplayMode(new DisplayMode(500, 500)); Display.create(); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(-5, 5, -5, 5, -10, 5); glMatrixMode(GL_MODELVIEW); float x = 0; while (!Display.isCloseRequested()) { Display.update(); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); glEnable(GL_DEPTH_TEST); glColor3f(1, 0, 0); x += 0.01f; glRotatef(x, x, 3 * x, 0.5f * x); glBegin(GL_QUADS); drawCube(); glEnd(); glLoadIdentity(); } Display.destroy(); Which basically draws a 1x1x1 cube in the window. Method drawCube() is this: public void drawCube(

OpenGL: Managing and editing large amounts of line strips

為{幸葍}努か 提交于 2019-12-05 21:35:36
I am currently working on a small 2D game with LWJGL. I use line strips to draw randomly generated grass. Each of the blades consists of 6 points and has a random green color. The problem I face: To fill the ground with a gapless layer of grass, I need approx. 400 line strips... In addition, every line strip has to be shifted, when the player moves around and should (optionally) wave in the wind. Therefore I need to change the data of 400 vbos every frame. Is there any way to accelerate these operations? My Code: //upload the vertex data void uploadGrass(int offset){ FloatBuffer grassBuffer

LWJGL grabbed mouse - debug if application hangs or when breakpoint hits with grabbed mouse

冷暖自知 提交于 2019-12-05 14:43:09
I have a LWJGL program (LWJGL 2.9.0) that sometimes randomly hangs. The problem with debugging it is that mouse is always grabbed. On Windows it's possible to get mouse back without any issues, but on linux (I use linux Kubuntu) the only way I know to get mouse back is to stop the application. The same issue happens when a breakpoint hits when mouse is grabbed. Using netbeans debug mode I can pause application and get some information at any time, but when the application hangs mouse no longer works (there is no cursor). Is it possible to get the mouse back without stopping the application or

How to calculate direction vector from yaw angle?

风流意气都作罢 提交于 2019-12-05 12:28:48
I have an issue on where I do not know how to proceed on calculating a direction vector using Java/LWJGL to renderin OpenGL. I have the following system: +X goes to the right of the screen +Z goes into my screen +Y goes to the top of the screen (altitude) Therefore I am walking on the XZ plane, now I want to implement/have implemented WASD movement, and it should be related to the current direction I am going. (W = forward to camera look direction, S = backward, etc.) I have a yaw angle that is defined as follows: 0 degrees if going straight forward 90 degrees if going to the right 180 degrees

Convert yaw, pitch AND roll to x,y,z vector in world coordinates

落爺英雄遲暮 提交于 2019-12-05 12:16:30
I'm working on some simple 3d graphics in OpenGL (java LWGJL), and I'm trying to figure out how to convert yaw, pitch and roll to the x, y and z components of my movement Vector. I know how to do this with just pitch and yaw (as explained here ), but I haven't found anything the explains how to integrate roll into this formula. I am aware that yaw and pitch are all that is needed to define a vector in 3d space, but I also need roll in this instance. I have keys bound to different movements relative to the camera in a basic WASD configuration ( A is local left, W is local forward, SPACE is

How to render a 3d cube in LWJGL?

廉价感情. 提交于 2019-12-05 11:42:01
I can`t find a good tutorial on the web, about rendering a 3d cube in the Lightweight Java Game Library! I have been learning LWJGL for some time now. I know how to draw 2d objects. Could Somebody Help me? Here is a lesson of a tutorial for "normal" OpenGL but in the bottom of the site you can find code for the tutorial lesson in plenty of different languages and libraries, including Java with LWJGL. To get the java code out of this jar you can open it with e.g. 7-zip and find the .java file in the folder named Lesson05. 来源: https://stackoverflow.com/questions/11840203/how-to-render-a-3d-cube

Why does glValidateProgram fail when no VAO is bound?

我只是一个虾纸丫 提交于 2019-12-05 09:37:12
I have a problem validating my shader program in LWJGL/OpenGL 3. I read the documentation, but I can't seem to find a reason why a VAO is needed when calling glValidateProgram. int program = glCreateProgram(); int vertexShader = glCreateShader(...); int fragmentShader = glCreateShader(...); // ... vertex and fragment shader loading, compiling, errorchecking ... glAttachShader(program, vertexShader); glAttachShader(program, fragmentShader); glBindAttribLocation(program, 0, "position"); glBindAttribLocation(program, 1, "color"); glLinkProgram(program); glDetachShader(program, shader);

LWJGL Window with Transparent Background?

…衆ロ難τιáo~ 提交于 2019-12-05 03:23:31
问题 I would like to create a window such that there is no "black background" area, but instead you see through to any other windows that are open, etc. That is, render the scene and only the scene, leaving no frame and no background area. I've read about a method that involves rendering to a hidden OpenGL window and buffering it in memory, creating a transparent layered window, and copying from memory to the transparent window. Obviously this is very cpu/memory intensive, so I was wondering if