The different addressing modes of CUDA textures

I am using a CUDA texture in border addressing mode (cudaAddressModeBorder). I am reading texture coordinates using tex2D<float>(). When the texture coordinates fall outside the texture, tex2D<float>() returns 0. How can I change this returned border value from 0 to something else? I could check the texture coordinate manually and set the border value myself. … Read more

sf::Texture applied in a wrong way

In my 2D isometric engine, I have the following classes: maps(variable)/layers(variable)/cubes(variable)/sides(6)/points(4)/coordinates(3) Each sides contains 4 points(1 point = 1 coordinate(x, y, z)). Each cubes contains 6 sides. I can create a map with the size I want with cubes(same, the size I want). Folders: assets/numTexture/numLight.png I calculate with numTexture and numLight a number which is … Read more

Repeating a texture over a plane in SceneKit

I have a 32×32 .png image that I want to repeat over a SCNPlane. The code I’ve got (See below) results in the image being stretched to fit the size of the plane, rather than repeated. CODE: let planeGeo = SCNPlane(width: 15, height: 15) let imageMaterial = SCNMaterial() imageMaterial.diffuse.contents = UIImage(named: “art.scnassets/grid.png”) planeGeo.firstMaterial = imageMaterial … Read more

How to use glDrawElements while keeping Texture Coordinates correct?

I’m using/targetting OpenGL 4.20, GSLSL 4.20, core. Using C. I’m exploring graphics with OpenGL and have decided to make a tile based game. I’m at the point where i’d like to actually draw a bunch of tiles, and am trying to use glDrawElements to draw individual triangles. Relevant code: const float vertexPositions[] = { -1.0f, … Read more

Vulkan – draw texture directly without vertices and shaders

Is it possible to draw texture (if it is with correct width, height and pixel format) directly to frame buffer without using vertices and shaders in Vulkan? Answer You can do a vkCmdCopyImage to copy from your vkImage to a swapchain’s vkImage provided the vkSurface supports being a TRANSFER_DST as by the supportedUsageFlags field from … Read more