Tag Info

Hot answers tagged

6

How are you passing your normals to the vertex shader? It looks like those are the normals for each of the six faces of a cube, but the vertex shader operates on vertices, not faces. Unless you're doing something unusual, you need to specify a normal for each vertex. In addition, if you want a cube to look right, you will need 24 vertices rather than 8, so ...


3

In my experience with android, it is the garbage collection the kills the performance, not the allocation, although these two are tied hand and hand. As mentioned on the comments, pre-allocation is a way to deal with this issue. This is known as a memory pools. Another similar solution is object pool pattern. An object pool allocates as needed, but does ...


2

You can explicitly get those numbers from id = glGetAttribLocation(program, name); after linking; the name is the string that appears in the vertex shader for the attribute. For example if you passed "vertexPosition" for name then you would get 0. If the layout information is not in the shader then openGL will create a default layout (usually in order as ...


1

What you need is double buffering I stole this from somewhere just to give you a quick answer: "Double buffering is conceptually pretty simple, instead of drawing your objects one by one, you draw them on an image and then tell the renderer to draw that entire image. This eliminates the flickering. Here's an example of how you might do this" class ...


1

I figured out the problem myself! After printing the coordinates of the mouse to the console I realized that where just something missing with my Input. Sure enough, I added GameContainer to the constructor of minigun and set input to equal GameContainer.getInput();. It works perfectly now :D public Minigun(GameContainer container){ try { ...



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