Tag Info

Hot answers tagged


You are checking how many bytes there are per pixel, but you are not checking how colours are ordered, and it could be RGBA or BGRA (or possibly something else). You need something like this instead of mode = GL_RGBA (little-endian machines): if (surface->format->Rmask == 0x000000ff) mode = GL_RGBA; else mode = GL_BGRA; If you want a more ...


A tough one. Let's try. Let noise be your (infinite) noise function. Let Seam_noise be a seamless noise function in the dimension of your tiles. (here is an example , you can download c# code with a seamless perlin noise implementation ) Follow an example of seamless perlin repeated 4X4 times (the red quad is your tile dimension) Consider a "filter" ...


Here's a really simple improvement: Define a method that sets the texture coordinates as pixels. Something like: void setTexCoordsI(int x, int y, int w, int h) { float TEXTURE_SIZE = 2048.0f; setTexCoords(x/TEXTURE_SIZE, y/TEXTURE_SIZE, w/TEXTURE_SIZE, h/TEXTURE_SIZE); } Then call: setTexCoordsI(300, 500, 100, 100); instead of: ...


"Smaller" and "bigger" are relative terms, of course. That said, tessellating your surfaces (i.e. breaking them into smaller triangles) will usually help up to a point, and then it'll hurt. Large triangles suffer from a number of problems. For one, any per-vertex shader calculations will result in more obvious artifacts along the edges between triangles of ...


Create a lightmap in your 3D-modeling-program (e.g. blender). Load it into your game without changing the object's UV-coordinates Make your game multiply the diffuse-texture with the lightmap.


I made a very stupid mistake: I forgot to make the call to glViewport(), as the texture is a different size then the screen. I forgot I had to do that.


First of all don't use glCopyTexImage2D with FBOs, the whole point of using FBO is to avoid copying, and have multirender target support on the GPU side without copying. FBO acts as a container of buffers and redirect rendering output to those buffers, without copying anything. For instance you can attach a texture object or pixel buffer object to the ...

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