texture-mapping

How to copy CUDA generated PBO to Texture with Mipmapping

 ̄綄美尐妖づ 提交于 2019-12-12 15:30:47
问题 I'm trying to copy a PBO into a Texture with automipmapping enabled, but it seems only the top level texture is generated (in other words, no mipmapping is occuring). I'm building a PBO using //Generate a buffer ID called a PBO (Pixel Buffer Object) glGenBuffers(1, pbo); //Make this the current UNPACK buffer glBindBuffer(GL_PIXEL_UNPACK_BUFFER, *pbo); //Allocate data for the buffer. 4-channel 8-bit image glBufferData(GL_PIXEL_UNPACK_BUFFER, size_tex_data, NULL, GL_DYNAMIC_COPY);

Segmentation fault at 'ilutGLLoadImage'

给你一囗甜甜゛ 提交于 2019-12-12 03:18:27
问题 Anyone happen to know why I'm getting a segmentation fault at line 2 below (this is after all my glInit stuff)? I've tried different image formats (.jpeg, .png, .bmp, all from internet). Debug tips or anything helps! If you wanna see more source, ask and I'll edit promptly. ilutRenderer(ILUT_OPENGL); GLuint tex1 = ilutGLLoadImage("/home/brent/Desktop/myimage.jpeg"); gdb backtrace, for what it's worth: #0 0x00000000 in ?? () #1 0x021b318e in ilDetermineType ( FileName=0x804ad84 "/home/brent

OpenGl texturing … ppm background

旧时模样 提交于 2019-12-12 02:35:22
问题 i am using a ppm loader to set image as a background , but there is a problem in colors here is the code and the image that i am use . http://imgur.com/w732d6j http://imgur.com/mJr26Ik here is the code ..... texture.h #ifndef TEXTURE_H #define TEXTURE_H struct Image { unsigned char* pixels; int width; int height; int numChannels; }; class Texture { public: Texture (); void Prepare (int texN); void ReadPPMImage (char *fn); GLuint texName; Image image; }; #endif texture.cpp #include <fstream>

equivalent from MATLAB to Python

↘锁芯ラ 提交于 2019-12-11 19:14:13
问题 I just have started with Python and I would translate this example from MATLAB to Python, but I have not found the equivalent in Python. https://www.mathworks.com/help/matlab/ref/surface.html load clown surface(peaks,flipud(X),... 'FaceColor','texturemap',... 'EdgeColor','none',... 'CDataMapping','direct') colormap(map) view(-35,45) Thanks! 回答1: Matplotlib offers nearly all plotting options Matlab does. Surface plots can be done as well: http://matplotlib.org/mpl_toolkits/mplot3d/tutorial

Texture coordinates for rendering a 3d sphere

狂风中的少年 提交于 2019-12-11 16:53:02
问题 I am drawing a 3d sphere using GL_QUAD_STRIP primitive and it works except I don't know how to set up the texture coordinates. I have a certain number of division that divide my sphere into equal number of latitudes and longitudes. Hence, the sphere's vertices are approximated using the divisions as follows float x, y, z, dTheta=180/divisions, dLon=360/divisions, degToRad=3.14/180 ; for(float lat =0 ; lat <=180 ; lat+=dTheta) { glBegin( GL_QUAD_STRIP ) ; for(float lon = 0 ; lon <=360; lon+

three.js: rendering 3d text with custom texture

时间秒杀一切 提交于 2019-12-11 08:15:34
问题 I've been wondering is it possible to do skinning to the 3d text with loaded images as texture? I knew you could do it with cubes and others since most of the sample were showing tutorials how to do it. What did I tried was map it with THREE. ImageUtils.loadTexture directed from the path but what did i get is some transparency object. I wonder how to use the same concept such as: CubeGeometry(width, height, depth, widthSegments, heightSegments, depthSegments, listofmaterials) in TextGeometry

Texture mapping an NGon?

感情迁移 提交于 2019-12-11 05:53:47
问题 I'm not sure how to go about figuring out how to map texture cooridnates for a 2D NGon (N sided polygon) How can this be done? The effect i'm trying to achieve is for the texture to fit on the polygon and stretch out accordingly so the whole texture fits on it. Thanks 回答1: Remember that when rendering an ngon in OpenGL, it's just a whole bunch of triangles. Also, you're taking some shape and trying to map it to a rectangle, so you have to be extremely critical of how you wish to do this as

Assigning texture to an object using multiple textures

北城以北 提交于 2019-12-11 03:24:35
问题 I'm making a object loader, and all the texture parts are in different texture files. What is the best solution of having it mapped on the model? Do I need to treat every part that has it's own texture as 1 model, so that the final body has many separate drawing calls with one texture each? 回答1: With the advent of the programmable rendering pipeline (i.e.: shaders ) you can now apply and combine multiple textures to meshes without the need for multiple draw calls. Modern GPUs have several

Render face of cube map to a quad

假如想象 提交于 2019-12-11 01:54:07
问题 I have a cube map texture in OpenGL, and I'd like to render one face of the cube to a single quad. What texture coordinates should I use? To be concrete, what coordinates should I pick to render the "GL_TEXTURE_CUBE_MAP_POSITIVE_X" face? Or if I shouldn't explicitly define coordinates, how should I use texture coordinate generation in this instance? 回答1: The texture coordinates you want are (1, +/-1, +/-1) 来源: https://stackoverflow.com/questions/8565093/render-face-of-cube-map-to-a-quad

Buggy UV coordinates of sphere in OpenGL?

匆匆过客 提交于 2019-12-11 00:30:51
问题 I am having buggy texture map on my sphere. The issue is well known but solution is rare. This is my code for generating UVs for a sphere. T = triangles, Nv = vertex normals. for (int i=0; i<nbF; i++) { float tx1 = atan2(Nv[T[i].v1].x, Nv[T[i].v1].z) / (2.0f*M_PI) + 0.5f; float ty1 = asinf(Nv[T[i].v1].y) / M_PI + 0.5f; float tx2 = atan2(Nv[T[i].v2].x, Nv[T[i].v2].z) / (2.0f*M_PI) + 0.5f; float ty2 = asinf(Nv[T[i].v2].y) / M_PI + 0.5f; float tx3 = atan2(Nv[T[i].v3].x, Nv[T[i].v3].z) / (2.0f*M