textures

How to use GL_REPEAT to repeat only a selection of a texture atlas? (OpenGL)

南楼画角 提交于 2020-01-01 04:03:06
问题 How can I repeat a selection of a texture atlas? For example, my sprite (selection) is within the texture coordinates: GLfloat textureCoords[]= { .1f, .1f, .3f, .1f, .1f, .3f, .3f, .3f }; Then I want to repeat that sprite N times to a triangle strip (or quad) defined by: GLfloat vertices[]= { -100.f, -100.f, 100.f, -100.f, -100.f, 100.f, 100.f, 100.f }; I know it has something to do with GL_REPEAT and textureCoords going passed the range [0,1] . This however, doesn't work: (trying to repeat N

cudaArray vs. device pointer

早过忘川 提交于 2019-12-31 14:27:51
问题 I am confused about the difference between the intended use of device pointers and cudaArray structures. Could someone please explain why I would use one versus the other? My basic problem is that after looking through documentation and reading the book "CUDA by Example," I do not understand the intent of the API designers. From what I have seen, it seems that cudaArray should be used for textures and pointers should be used for directly accessing memory. It also seems that 3D textures can

Unhandled exception in for loop

五迷三道 提交于 2019-12-31 07:37:18
问题 I'm trying to create two textures for my OpenGL project. Initially i created the textures seperately and this worked perfectly fine. Not to repeat myself, I decided to attempt to make them as an array and use a for loop to perform the steps twice. unsigned int textures[2]; int width, height, nrChannels; unsigned char *data = stbi_load("C:\\Users\\A\\Desktop\\wall.jpg", &width, &height, &nrChannels, 0); glGenTextures(2, textures); for (int i = 0; i < 2; i++) { glBindTexture(GL_TEXTURE_2D, (i =

In XNA, what is the best method to dispose of textures I no longer need?

微笑、不失礼 提交于 2019-12-31 03:23:25
问题 I started a project with the concept of reusing the same texture2d objects continuously throughout the game, reloading new textures periodically. Over time this proved a bad idea as I was running in to: System.OutOfMemoryException bool loadImages(string image) { System.Diagnostics.Debug.WriteLine("beginning loading textures " + image); try { //image_a = null; //image_o = null; //image_o.Dispose(); //image_a.Dispose(); image_o = Content.Load<Texture2D>("images/"+image); image_a = Content.Load

SDL: Render Texture on top of another texture

℡╲_俬逩灬. 提交于 2019-12-30 18:29:15
问题 i am having trouble with the following: I need to render a texture on top of another texture and then render that main texture. For example I have the blue rectangle texture, and I want to draw red rectangles on top of this blue rect. However i want them to restrict the render only on this rectangle. Like the following image: I read something about texture blit between them or something like that but im not sure if this is posible. My code looks like this: SDL_RenderCopy(ren,bluetexture,NULL

LibGDX: Filtering a scaled TextureRegion

北城余情 提交于 2019-12-30 08:25:36
问题 I have several objects with different textures for different states, so I am using a TextureAtlas made with TexturePacker, and resizing the TextureRegion where I need it. I have to resize because not only am I trying to support both 720p and 1080p, but some of my objects are tiles or cursors which resize based on the width and height of the board, as that can change in my game whereas the board will always occupy the same percentage of the screen. With a Texture , I can just do this: texture

Is it possible to use WebGL max texture size?

僤鯓⒐⒋嵵緔 提交于 2019-12-30 06:38:30
问题 I am working on an app where higher resolution is always better. But I'm stuck with WebGL max_texture_size problems. I create an image of size exactly this dimension (16384x16384 on my laptop) and WebGL crashes saying that: GL_INVALID_ENUM : glBindFramebuffer: target was GL_READ_FRAMEBUFFER_ANGLE GL_INVALID_ENUM : glBindFramebuffer: target was GL_READ_FRAMEBUFFER_ANGLE WebGL: CONTEXT_LOST_WEBGL: loseContext: context lost And the same happen when I try with 0.75 of the max values. Only working

Floating Point Textures in OpenGL ES 2.0

我的未来我决定 提交于 2019-12-30 06:08:07
问题 I've been trying to figure out how to use float textures in GLES2. The API Reference (http://www.khronos.org/opengles/sdk/docs/man/glTexImage2D.xml) says that only unsigned bytes and shorts can be used, but i've seen people saying it is supported elsewhere. I could use GL_LUMINANCE as the texture format but that only gets me one float value. If anyone has some insight i'd appreciate it. 回答1: In OpenGL ES 2.0, floating-point textures are only supported if the implementation exports the OES

Floating Point Textures in OpenGL ES 2.0

旧街凉风 提交于 2019-12-30 06:06:03
问题 I've been trying to figure out how to use float textures in GLES2. The API Reference (http://www.khronos.org/opengles/sdk/docs/man/glTexImage2D.xml) says that only unsigned bytes and shorts can be used, but i've seen people saying it is supported elsewhere. I could use GL_LUMINANCE as the texture format but that only gets me one float value. If anyone has some insight i'd appreciate it. 回答1: In OpenGL ES 2.0, floating-point textures are only supported if the implementation exports the OES

How to repeat the texture map like GL_REPEAT?

蓝咒 提交于 2019-12-29 07:36:15
问题 I have a house model in my game, and I have some materials for the house geometry. There is a material for the wall of the house, and I have a texture-map-image to show the bricks. var mat = new THREE.MeshPhongMaterial( { ambient: 0x969696, map: THREE.ImageUtils.loadTexture( 'textures/G/G0.jpg' ), overdraw: true,combine: THREE.MultiplyOperation } ); In this way above, the texture map appears like GL_CLAMP I want it to show like GL_REPEAT . What should I do? If you can not see the images check