texturing

glTexImage2D vs. gluBuild2DMipmaps

浪子不回头ぞ 提交于 2020-01-02 08:13:28
问题 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 )

Terrain Texturing

醉酒当歌 提交于 2019-12-13 20:44:42
问题 Is there a way to blend 2 textures in a gradient manner? ex. first textures starts at top and goes to the bottom, and second one starts bottom and goes top. I want to make them loose opacity like in a gradient to create a smooth connection. Is it possible? Maybe there is some other way to create such textures? The problem is that the difference in heights in my terrain does not look really well - in one square area, one triangle has a different texture than the other. 回答1: For every terrain

Three.js texture not repeating properly

做~自己de王妃 提交于 2019-12-13 20:35:07
问题 I'm trying to repeat a 16x16 texture on a plane, but when I set the texture to repeat I get the following result: The texture is shown correctly in the bottom left of the plane, but it looks as though the top and right edges are stretched across the rest of the plane. So far I've been unable to find out why it does this. This is the code: function addTerrain(){ var texture = THREE.ImageUtils.loadTexture( "tex/tex.png" ); texture.WrapS = texture.WrapT = THREE.RepeatWrapping; texture.repeat.set

technique and speed expectations for opengl text labeling

北城余情 提交于 2019-12-13 00:24:51
问题 I am using opengl (fixed-function pipeline) and I'm drawing potentially hundreds of thousands of points, and labeling each with a text label. This question is about whether I'm doing this in a reasonable way, and what I can expect in terms of speed. The text labels are drawn by creating a texture coordinate rectangle for each character, and texturing the rectangles using a small font bitmap (each character is about 5x13 pixels in the texture). In a test file, I have about 158,000 points,

QQuickFramebufferObject: When using an Item, whose parent has “visible: false”, as texture source, nothing is displayed

我与影子孤独终老i 提交于 2019-12-12 01:22:00
问题 This works fine in Canvas3D, but not in QQuickFramebufferObject. My code I've based my testcase on the textureinsgnode sample app bundled with Qt. Since mine is a derived work, I have to first post the license terms here: /**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file

Changing polygons' colors in Maya via Python

喜夏-厌秋 提交于 2019-12-11 18:04:04
问题 The only way I know is to use a slider: import maya.cmds as cmds cmds.colorSliderGrp( 'polygonColour', label = "Colour", hsv = ( 1, 1, 1 ) ) Then taking the RGB value from that: rgb = cmds.colorSliderGrp( 'polygonColour', query = True, rgbValue = True ) And then assigning a material to the polygon and giving that material the color: myShader = cmds.shadingNode( 'lambert', asShader = True, name = "polygonMaterial" ) cmds.setAttr( 'polygon1' + ":blockMaterial.color", rgb[ 0 ], rgb[ 1 ], rgb[ 2

lodepng on windows of ogl texture crash

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 17:51:20
问题 I'm using lodePNG to load texture from a png file but the program crashes when I load the texture. char* filename = "texture.png"; unsigned width, height; std::vector<unsigned char>image; GLuint texture[1]; //decode unsigned error = lodepng::decode(image, width, height, filename); if(error) std::cerr << "decoder error " << error << ": " << lodepng_error_text(error) << std::endl; glBindTexture(GL_TEXTURE_2D, texture[0]); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL

OpenGL texture loading issue

*爱你&永不变心* 提交于 2019-12-11 09:19:01
问题 This is a very vague problem, so please feel free to clarify anything about this project. I'm working on a very large application, and recently a very perplexing bug has cropped up regarding the texturing. Some of the textures that we are loading are being loaded - I've stepped through the code, and it runs - but all OpenGL renders for those textures is a weird Pink/White striped texture. What would you suggest to even begin debugging this situation? The project is multithreaded, but a mutex

GLSL textureCube and texture2D in same shader

让人想犯罪 __ 提交于 2019-12-11 01:12:40
问题 I can't seem to be able to have both texture2D() and textureCube() in one shader. When I do, nothing shows up and there is no error. I tried this both with my own shader loader and the Apple GLSL shader builder and the same thing happens. It happens even if I have textureCube() in the vertex shader and texture2D() in the fragment. They seem to work fine by themselves, but as soon as they're called together, no matter in which order, nothing shows up. 回答1: You need to bind both textures as

LibGdx GLES2.0 cube texel stretching

◇◆丶佛笑我妖孽 提交于 2019-12-11 00:25:25
问题 I've been programming OpenGL on Windows/SDL for a few years and am able to do quite a lot of advanced things with it. I've switched over to Android and libgdx and over the past few days have tried to put a simple demo together, just a spinning cube. Using libgdx's ObjLoader and Mesh classes, I loaded a cube mesh exported from blender(with normals and uv coords), and tried to apply a texture, and it draws a cube, but seems to only uses one texel from the texture to cover the whole model. I've