textures

Metal rendering odd darker textures even with [MTKTextureLoader.Option.SRGB : false]?

。_饼干妹妹 提交于 2020-05-24 06:10:49
问题 I already checked this question. Using [MTKTextureLoader.Option.SRGB : false] in texture loader options doesn't work. All that happens is when I do [MTKTextureLoader.Option.SRGB : true] , it's a lot darker instead of slightly darker. There must be something else. Here is an example of this unwanted behavior. Here is the original texture for reference: As you can see I am using the mouse to hold the original packed ice texture over the rendered one. It's considerably lighter, even with

How to use OpenGL Array Texture?

喜你入骨 提交于 2020-05-15 11:55:28
问题 I am trying to use sprite sheet in OpenGL, implementing it through Array Texture This is how I load my texture: QImage image; image.load("C:\\QtProjects\\project\\images\\spritesheet.png", "png"); const unsigned char* data = image.bits(); int twidth = image.width(), theight = image.height(); glTexStorage3D(GL_TEXTURE_2D_ARRAY, 1, GL_RGBA, twidth / 3, theight / 4, 12); glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, twidth / 3, theight / 4, 12, GL_BGRA, GL_UNSIGNED_BYTE, data); glUseProgram

How to load a bmp on GLUT to use it as a texture?

廉价感情. 提交于 2020-05-09 13:57:52
问题 I've been searching all around for a simple solution to add sprites to my OpenGl GLUT simple moon lander game in c++ and it appears I must use bmp's since they're easiest to load and use them as textures on a rectangle. How exactly can I load the bmp's as textures though? 回答1: Look my simple c implementation function to load texture. GLuint LoadTexture( const char * filename ) { GLuint texture; int width, height; unsigned char * data; FILE * file; file = fopen( filename, "rb" ); if ( file ==

Skybox textures do not display correctly

倾然丶 夕夏残阳落幕 提交于 2020-04-14 07:36:53
问题 I have a problem with skybox textures. If you twist the camera, it creates a feeling that one texture overlays another, as in the screenshot: Skybox show code: private void drawSkybox(int texId){ glColor4f(1,1,1,1); glDepthMask(false); glEnable(GL_TEXTURE_CUBE_MAP); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_CUBE_MAP, texId); glBindVertexArray(vao[0]); glBindBuffer (GL_ARRAY_BUFFER, vbo[0]); glDrawArrays(GL_TRIANGLES, 0, 36); glBindVertexArray(0); glBindBuffer (GL_ARRAY_BUFFER, 0)

Skybox textures do not display correctly

六月ゝ 毕业季﹏ 提交于 2020-04-14 07:36:06
问题 I have a problem with skybox textures. If you twist the camera, it creates a feeling that one texture overlays another, as in the screenshot: Skybox show code: private void drawSkybox(int texId){ glColor4f(1,1,1,1); glDepthMask(false); glEnable(GL_TEXTURE_CUBE_MAP); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_CUBE_MAP, texId); glBindVertexArray(vao[0]); glBindBuffer (GL_ARRAY_BUFFER, vbo[0]); glDrawArrays(GL_TRIANGLES, 0, 36); glBindVertexArray(0); glBindBuffer (GL_ARRAY_BUFFER, 0)

Update texture with three.js

↘锁芯ラ 提交于 2020-03-25 19:15:26
问题 I've got a textured model in three.js and I want to be able to swap out the texture defined in the .gltf file when the page loads. I've looked here for inspiration. "images": [ { "uri": "flat_baseColor.png" }, // etc So to update the texture I do var images = [ "./textures/01.jpg", // "./textures/01.jpg", ]; var texture = new THREE.TextureLoader().load( images[0] ); var my_material = new THREE.MeshBasicMaterial({map: texture}); // load the model var loader = new GLTFLoader().setPath( 'models

How can I get rid of blurry textures in Metal?

蹲街弑〆低调 提交于 2020-03-21 10:55:28
问题 I just created a Metal template and changed up the code a little. I switched out the default colormap with the Minecraft 16x16 lapis ore texture, but for some reason they are blurred out when they are low resolution. I am trying to achieve that pixelated, Minecraft look and so would like to know how to disable this blurring/filtering. Is there a way to load/present assets without this blurring? Here is my load asset function: class func loadTexture(device: MTLDevice, textureName: String)

Using single channel texture (OpenGL 2)?

前提是你 提交于 2020-02-25 04:32:08
问题 Short storry: when I render anything using texture loaded like this glTexImage2D ( GL_TEXTURE_2D, 0, GL_R8, width, height, 0, GL_RED, GL_UNSIGNED_BYTE, pixels ); I get only black Long storry: I can get RGBA texture with alpha channel (e.g. text with transparent backgorund using this code): This code works: // === load #define GL_ABGR 0x8000 SDL_Surface * surf = SDL_LoadBMP( "common_resources/dejvu_sans_mono_RGBA.bmp" ); glGenTextures ( 1, &itex ); glBindTexture ( GL_TEXTURE_2D, itex );

Using single channel texture (OpenGL 2)?

北战南征 提交于 2020-02-25 04:31:37
问题 Short storry: when I render anything using texture loaded like this glTexImage2D ( GL_TEXTURE_2D, 0, GL_R8, width, height, 0, GL_RED, GL_UNSIGNED_BYTE, pixels ); I get only black Long storry: I can get RGBA texture with alpha channel (e.g. text with transparent backgorund using this code): This code works: // === load #define GL_ABGR 0x8000 SDL_Surface * surf = SDL_LoadBMP( "common_resources/dejvu_sans_mono_RGBA.bmp" ); glGenTextures ( 1, &itex ); glBindTexture ( GL_TEXTURE_2D, itex );

MeshLab: How to import XYZRGB file

自古美人都是妖i 提交于 2020-02-21 10:33:09
问题 When I import and XYZRGB (that I generate programatically), MeshLab renders the point-cloud, but the colors are missing. How can I assign textures/colors to vertices. I have tried "Vertex Attribute Transfer" but nothing happens. 回答1: Rename the extension .xyz to .txt. Then choose the x y z r g b option when importing the file. in meshlab source: http://www.laserscanningforum.com/forum/viewtopic.php?f=168&t=8052 来源: https://stackoverflow.com/questions/22850905/meshlab-how-to-import-xyzrgb-file