New answers tagged

0

There is a GitHub project made by kennux which gives compatible OpenCL abstraction, but there is no documentation and I have no idea if it's outdated. But you could just use LWJGL right? LibGDX with OpenCL made by Kennex


0

Welp, seems a bunch of RegEx works... if (Pattern.matches("[A-Za-z0-9\\s_\\+\\-\\.,!@#\\$%\\^&\\*\\(\\);\\\\/\\|<>\"'\\[\\]\\?=]", String.valueOf(Keyboard.getEventCharacter()))) { value += Keyboard.getEventCharacter(); }


0

Add this where you add the code to the string: value += String.valueOf(Keyboard.getEventCharacter()); value = value .replaceAll("[^\\w\\s\\]","");


0

You need to check for Character.isLetterOrDigit(char), and if it returns false, skip it.


0

Turns out I was using the wrong attribute index (3 instead of 1). In enabling attrib index 1 instead of 3, and changing my glVertexAttribPointer(3, 4, GL_FLOAT, false, 7*4, 3*4); to glVertexAttribPointer(1, 4, GL_FLOAT, false, 7*4, 3*4); I was able to solve the issue.


1

There are a couple potential reasons why it doesn't work: you have not enabled the Vertex Attrib 3: glEnableVertexAttribArray(3). you have not told GL where to find the color attribute: glBindAttribLocation(..., 3, "i_color") before linking. You should be doing the same thing for position, as Gabriel Roy mentioned, if you didn't yet.


0

Okay, I think your problem comes from the glVertexAttribPointer(0, 3, GL_FLOAT, false, 7*4, 0); Let me explain what this function does and what are its parameters :) The first parameter (0) specify which vertex attribute we want to allocate. This determine which determine which VAO pointer will be linked to your array. Remember that OpenGL is a state ...


0

In short, OpenGL is basically what the other two are built on. It has methods and classes that might come in handy, but I don't suggest using that. LWJGL is extremely powerful, but it's not too good for if you just want to write simple games. You'll end up reinventing the wheel by making your own methods to support those of LWJGL. It will come in handy ...


0

You can use also container reference, getInput and check if a key is pressed, down, etc.. For example: container.getInput().isKeyPressed(Input.KEY_SPACE) see more details on javadoc


1

I don't know if this could help you, but this is everything I do for good MipMapping: public int loadTexture(String fileName){ Texture texture = null; try { texture = TextureLoader.getTexture("PNG", new FileInputStream("res/textures/"+fileName+".png")); GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D); //I preffer LINEAR_MIPMAP because ...


1

If I understand you correctly you are having problems going left and right. First off currentFrontSpeed should never be negative since it's speed not velocity. Speed is a scalar and as such should not capture any direction and will always be positive. To move in different directions you should modify the angle instead where for example right is -90 from ...


3

You load your images like this: texture = TextureLoader.getTexture("PNG", new FileInputStream("res/" + fileName + ".png")); However if you read through the source code of slick you'll see that internally it is represented as TextureImpl which was the following documentation. A texture to be bound within JOGL. This object is responsible for keeping ...


0

I've just figured out a decent system wich works quite perfectly; So, first of in your main update method you manage the inputs like usual: l = Keyboard.isKeyDown(Input.KEY_A); r = Keyboard.isKeyDown(Input.KEY_D); u = Keyboard.isKeyDown(Input.KEY_W); d = Keyboard.isKeyDown(Input.KEY_S); if(l){ setXvel(-speed*delta); //Note: you dont have to use ...


2

You seem to just show the foliage at pre-determined distance. Why don't you lerp foliage opacity between transparent and opaque across some distance range? Could be the simplest most noticeable improvement.


2

GL11.glColor3f(alpha, alpha, alpha); won't work for 2 reasons: It's opaque. You'd need GL11.glColor4f(alpha, alpha, alpha,alpha); It affects the next object to be rendered, not everything already rendered. It would be easier to render a semi-transparent quad over the whole screen (with a slightly higher z-depth) prior to drawing the menu. This will cut ...


1

The best way to solve this is not with trigonometry, but with vector math! I'm going to write some quick pseudocode of what you need to check for difference in angles, if you want the juicy details of the whys and hows scroll further down. Summary: float l1x = entity.getPosition().x - player.getPosition().x; float l1y = entity.getPosition().y - ...


0

Solved by using vsync. private static AppGameContainer gameApp; gameApp.setVSync(true);



Top 50 recent answers are included