textures

THREE.JS: Seeing geometry when inside mesh

无人久伴 提交于 2019-12-01 17:03:56
When entering the geometry, for example a sphere mesh, it acts as if the geometry doesn't exist. The color and texture are visible on the outside. But once I zoom into the mesh, the properties are gone. How can I make the color and texture of a sphere mesh be visible inside the mesh? mesh.material.side = THREE.DoubleSide; Or mesh.material.side = THREE.BackSide; three.js r.62 来源: https://stackoverflow.com/questions/19825061/three-js-seeing-geometry-when-inside-mesh

What does GL_UNSIGNED_BYTE mean for glTexImage2D?

纵然是瞬间 提交于 2019-12-01 16:31:16
问题 I want to load a byte array containing a texture in RGBA 8888 format. The OpenGL ES docs offer 4 constants to use: GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_4_4_4_4, and GL_UNSIGNED_SHORT_5_5_5_1. On regular OpenGL, there is a value GL_UNSIGNED_INT_8_8_8_8 that meets my needs -- and the numbers are interpreted thus: For example, if internalFormat is GL_R3_G3_B2, you are asking that texels be 3 bits of red, 3 bits of green, and 2 bits of blue. So GL_UNSIGNED_INT_8_8_8_8 must

THREE.JS: Seeing geometry when inside mesh

空扰寡人 提交于 2019-12-01 15:01:42
问题 When entering the geometry, for example a sphere mesh, it acts as if the geometry doesn't exist. The color and texture are visible on the outside. But once I zoom into the mesh, the properties are gone. How can I make the color and texture of a sphere mesh be visible inside the mesh? 回答1: mesh.material.side = THREE.DoubleSide; Or mesh.material.side = THREE.BackSide; three.js r.62 来源: https://stackoverflow.com/questions/19825061/three-js-seeing-geometry-when-inside-mesh

cuda 3D texture Interpolation

家住魔仙堡 提交于 2019-12-01 14:55:14
I am trying to interpolate a 3D array with cuda using texture memory with the code below. I have plotted the input f[x][y][z] to a fixed z value, then I interpolate my array for x and y and plot i again and they look totally different. I also tried this in 1 dimension (with a different code) and there it works so i assume that there must be an error in my code. Can you help me finding it? #include <cuda_runtime.h> #include <cuda.h> #include <iostream> #include <fstream> typedef float myType; texture<myType, 3> tex; cudaArray *d_volumeArray = 0; #define gpuErrchk(ans) { gpuAssert((ans), __FILE_

White lines(or spaces) shows up on the borders of the Textures as I move camera. Java, OpenGL

爷,独闯天下 提交于 2019-12-01 14:26:59
Textures are drawn incorrectly. As I see, Program changes the top line of pixels with the bottom line. And it changes the left column with the right one. If Texture is empty, let's say, on the top, but there are black pixels on the bottom -- when you "move camera" Up or Down you'll see that bottom line becomes empty, and top line becomes black from time to time. So it changes columns as you're moving Left or Right as well. To escape this, I've tried to erase all of the pixels on the borders and move textures closer one to another for few pixels, to "glue them up" somehow. But the effect was

OpenGL - Power Of Two Textures

谁都会走 提交于 2019-12-01 14:12:28
OpenGL uses power-of-two textures. This is because some GPUs only accept power-of-two textures due to MipMapping. Using these power-of-two textures causes problems when drawing a texture larger than it is. I had thought of one way to workaround this, which is to only use the PO2 ratios when we're making the texture smaller than it actually is, and using a 1:1 ratio when we're making it bigger, but will this create compatibility issues with some GPUs? If anybody knows whether issues would occur (I cannot check this as my GPU accepts NPO2 Textures), or a better workaround, I would be grateful.

Image loading using openGL, SOIL

孤街醉人 提交于 2019-12-01 13:09:26
I tried a lot of examples for loading and displaying images in openGL using SOIL. while running the source code below, it displays just a wite quad without an image. I tried to open an image called: foto. I placed the image-file in the folder of the program. bool* keyStates = new bool[256]; GLuint texture[0]; void resize(int height, int width) { const float ar = (float) width / (float) height; glViewport(0, 10, width, height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glFrustum(-ar, ar, -1.0, 1.0, 2.0, 90.0); //gluLookAt(0, 2, 0, -1, 1, -3, 0, 1, 0); glMatrixMode(GL_MODELVIEW);

Textured Line in CG

ぃ、小莉子 提交于 2019-12-01 12:42:07
I am working on a Drawing App for iOS. In this app i need to draw textured lines. For this i am using this method .But texture is so small and not in shape. I want to know what i did wrong and how can i resolve it. Here is my updated code- CGPoint mid1 = midPoint(previousPoint1, previousPoint2); CGPoint mid2 = midPoint(currentPoint, previousPoint1); [curImage drawAtPoint:CGPointMake(0, 0)]; CGContextRef context = UIGraphicsGetCurrentContext(); [self.layer renderInContext:context]; CGContextMoveToPoint(context, mid1.x, mid1.y); CGContextAddQuadCurveToPoint(context, previousPoint1.x,

CUDA: how to create 2D texture object?

扶醉桌前 提交于 2019-12-01 12:18:50
I'm trying to create 2D texture object, 4x4 uint8_t. Here is the code: __global__ void kernel(cudaTextureObject_t tex) { int x = threadIdx.x; int y = threadIdx.y; uint8_t val = tex2D<uint8_t>(tex, x, y); printf("%d, ", val); return; } int main(int argc, char **argv) { cudaTextureObject_t tex; uint8_t dataIn[16] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; uint8_t* dataDev = 0; cudaMalloc((void**)&dataDev, 16); struct cudaResourceDesc resDesc; memset(&resDesc, 0, sizeof(resDesc)); resDesc.resType = cudaResourceTypePitch2D; resDesc.res.pitch2D.devPtr = dataDev; resDesc.res.pitch2D

Can't call glGenTextures on multithreaded android app

假装没事ソ 提交于 2019-12-01 11:32:20
I'm making an OpenGLES Android app using Android NDK, expanding from android's gljni example, which can be found here It's using GLSurfaceView. Textures are initialized in a JNI function called from onSurfaceChanged() of GLSurfaceView.Renderer When the user touches screen, the app needs more textures. In order to do so, glGenTextures() is called in a JNI function called in onTouchEvent(). The problem is that the thread id (which gettid() returns) seems completely arbitrary and not always the same to the thread id that has the OpenGL context. It loads and shows up textures if the JNI function