textures

How to read back a CUDA Texture for testing?

和自甴很熟 提交于 2019-12-29 04:24:06
问题 Ok, so far, I can create an array on the host computer (of type float), and copy it to the gpu, then bring it back to the host as another array (to test if the copy was successful by comparing to the original). I then create a CUDA array from the array on the GPU. Then I bind that array to a CUDA texture. I now want to read that texture back and compare with the original array (again to test that it copied correctly). I saw some sample code that uses the readTexel() function shown below. It

Three.js texture / image update at runtime

半腔热情 提交于 2019-12-28 13:48:11
问题 I am trying to change a cube image at run time by selecting an option from Select Form element. When running the code, the image changes after selecting, but the previous cube and image stays in the scene. How I clear / refresh / update the scene properly when changing the material / image / texture. <div id = "container"></div> <form id = "changesForm"> Cube Image: <br> <select id = "cubeImage"> <option value = "random">Random</option> <option value = "image1">First Image</option> <option

Displaying true-colour 2D RGB textures in a 3D plot?

亡梦爱人 提交于 2019-12-28 13:36:08
问题 I'm trying to make a 3D plot that consists of a series of 2D planes through an RGB stack, like this: I know that it's possible to do this using mpl_toolkits.mplot3d by passing the x, y, z coordinates and the RGB(A) colours of each pixel to plot_surface : import numpy as np from matplotlib import pyplot as pp from mpl_toolkits.mplot3d.axes3d import Axes3D def plot_stack_slices(rgbstack, scale=(1., 1., 1.), z_interval=10.): fig, ax = pp.subplots(1,1,subplot_kw={'projection':'3d'}) ax.invert

Doing readback from Direct3D textures and surfaces

六眼飞鱼酱① 提交于 2019-12-28 12:08:28
问题 I need to figure out how to get the data from D3D textures and surfaces back to system memory. What's the fastest way to do such things and how? Also if I only need one subrect, how can one read back only that portion without having to read back the entire thing to system memory? In short I'm looking for concise descriptions of how to copy the following to system memory : a texture a subset of a texture a surface a subset of a surface a D3DUSAGE_RENDERTARGET texture a subset of a D3DUSAGE

iPhone OpenGL ES 2.0 - Pixel Perfect Textures

半腔热情 提交于 2019-12-28 11:58:52
问题 How can I get my textures to align with the screen pixels for pixel perfect graphics in OpenGL ES 2.0? This is critical for a project I'm working on which uses pixel art graphics. Any help on this would be great! 回答1: See my answer here: OpenGL Texture Coordinates in Pixel Space This has been asked a few times, but I don't have the links at hand, so a quick and rough explanation. Let's say the texture is 8 pixels wide: | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | ^ ^ ^ ^ ^ ^ ^ ^ ^ 0.0 | | | | | | | 1.0

iPhone OpenGL ES 2.0 - Pixel Perfect Textures

对着背影说爱祢 提交于 2019-12-28 11:58:14
问题 How can I get my textures to align with the screen pixels for pixel perfect graphics in OpenGL ES 2.0? This is critical for a project I'm working on which uses pixel art graphics. Any help on this would be great! 回答1: See my answer here: OpenGL Texture Coordinates in Pixel Space This has been asked a few times, but I don't have the links at hand, so a quick and rough explanation. Let's say the texture is 8 pixels wide: | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | ^ ^ ^ ^ ^ ^ ^ ^ ^ 0.0 | | | | | | | 1.0

Multitexturing theory with texture objects and samplers

蹲街弑〆低调 提交于 2019-12-28 06:53:07
问题 I couldn't find any good theory articles on how to code multitexturing with either only texture objects or texture objects plus samplers. I just don't know how to manage the glActiveTexture function and what it exactly does. glGenTextures(1, &texture); glActiveTexture(GL_TEXTURE0 + 0); // Number between 0 and GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS glBindTexture(GL_TEXTURE_2D, texture); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, img.getSize().x, img.getSize().y, 0, GL_RGBA, GL_UNSIGNED_BYTE, img

Render OpenGL scene to texture using FBO in fixed function pipeline drawing

懵懂的女人 提交于 2019-12-28 03:14:08
问题 The Problem I work on the open source game torcs (http://torcs.sourceforge.net/). The game's graphic pipeline is still using the fixed function pipeline (FFP) of OpenGL 1.3. I try to render the game scenes to textures in a FBO (Framebuffer Object) in order to do some post-processing on the rendered textures. I use OpenGL 3.3. on my machine. Currently I have set up the FBO with attached textures at GL_COLOR_ATTACHMENT0&1 (2 in order to have two consecutive frames readable in the shader) and an

opengl multiple textures [closed]

让人想犯罪 __ 提交于 2019-12-26 10:22:05
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed last year . I'm wanting to add multiple textures to my scene I have one texture working but I don't know how to include other textures as well. #include <windows.h> #include <gl\gl.h> #include <gl\glut.h> #include <stdlib.h> #include <iostream> void init(void); void display(void); void keyboard

opengl multiple textures [closed]

我怕爱的太早我们不能终老 提交于 2019-12-26 10:21:50
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed last year . I'm wanting to add multiple textures to my scene I have one texture working but I don't know how to include other textures as well. #include <windows.h> #include <gl\gl.h> #include <gl\glut.h> #include <stdlib.h> #include <iostream> void init(void); void display(void); void keyboard