texturing

Binding a zero texture in OpenGL

人走茶凉 提交于 2019-12-06 08:44:34
问题 In my program I use 2 textures: t0 and t1. t1 is additional, needed only in some cases: ..... glActiveTexture ( GL_TEXTURE1 ); if ( mDisplayMode == EDM_DEFAULT ){ glBindTexture( GL_TEXTURE_2D, 0 ); // In this case I don't need t1 }else{ glBindTexture( GL_TEXTURE_2D, mglDegreeTexture ); // In this case t1 will overlap t0 } shader->setUniformValue( "textureId1", 1 ); Shader for drawing: ..... vec4 c1 = texture( textureId0, uv ); vec4 c2 = texture( textureId1, gridUV ); float a = c2.a; gl

glTexImage2D vs. gluBuild2DMipmaps

橙三吉。 提交于 2019-12-06 00:29:17
Very basic OpenGL texture creation code: int width, height; BYTE * data; FILE * file; // open texture data file = fopen( filename, "rb" ); if ( file == NULL ) return 0; // allocate buffer width = 256; height = 256; data =(BYTE*) malloc( width * height * 3 ); // read texture data fread( data, width * height * 3, 1, file ); fclose( file ); glGenTextures( 1, &texture ); glBindTexture( GL_TEXTURE_2D, texture ); //gluBuild2DMipmaps( GL_TEXTURE_2D, 3, width, height, GL_RGB, GL_UNSIGNED_BYTE, data ); glTexImage2D( GL_TEXTURE_2D,0, GL_RGB, width, height,0, GL_RGB, GL_UNSIGNED_BYTE, data ); free( data

How much more efficient are power-of-two textures?

我是研究僧i 提交于 2019-12-01 17:56:55
I am creating an OpenGL video player using Ffmpeg and all my videos aren't power of 2 (as they are normal video resolutions). It runs at fine fps with my nvidia card but I've found that it won't run on older ATI cards because they don't support non-power-of-two textures. I will only be using this on an Nvidia card so I don't really care about the ATI problem too much but I was wondering how much of a performance boost I'd get if the textuers were power-of-2? Is it worth padding them out? Also, if it is worth it, how do I go about padding them out to the nearest larger power-of-two? datenwolf

How much more efficient are power-of-two textures?

大兔子大兔子 提交于 2019-12-01 17:12:54
问题 I am creating an OpenGL video player using Ffmpeg and all my videos aren't power of 2 (as they are normal video resolutions). It runs at fine fps with my nvidia card but I've found that it won't run on older ATI cards because they don't support non-power-of-two textures. I will only be using this on an Nvidia card so I don't really care about the ATI problem too much but I was wondering how much of a performance boost I'd get if the textuers were power-of-2? Is it worth padding them out? Also

OpenGL mapping texture to sphere

心已入冬 提交于 2019-11-30 20:14:04
I have OpenGL program that I want to texture sphere with bitmap of earth. I prepared mesh in Blender and exported it to OBJ file. Program loads appropriate mesh data (vertices, uv and normals) and bitmap properly- I have checked it texturing cube with bone bitmap. My program is texturing sphere, but incorrectly (or in the way I don't expect). Each triangle of this sphere includes deformed copy of this bitmap. I've checked bitmap and uv seems to be ok. I've tried many sizes of bitmap (powers of 2, multiples of 2 etc). Here's the texture: Screenshot of my program (like It would ignore my UV

OpenGL mapping texture to sphere

时间秒杀一切 提交于 2019-11-30 04:07:38
问题 I have OpenGL program that I want to texture sphere with bitmap of earth. I prepared mesh in Blender and exported it to OBJ file. Program loads appropriate mesh data (vertices, uv and normals) and bitmap properly- I have checked it texturing cube with bone bitmap. My program is texturing sphere, but incorrectly (or in the way I don't expect). Each triangle of this sphere includes deformed copy of this bitmap. I've checked bitmap and uv seems to be ok. I've tried many sizes of bitmap (powers