textures

position for texture in opengl

随声附和 提交于 2019-12-11 09:23:04
问题 i have a question concerning how to declare the points for a texture on a cube to be exactly i mean the: glTexCoord2f(x.f, y.f); for the front side, my declaration works: glBegin(GL_POLYGON); //Vorderseite glNormal3f(0.0f, 0.0f, 1.0f);//normale für vorderseite glTexCoord2f(0.0f, -1.f); glVertex3f(-fSeitenL/2.0f,-fSeitenL/2.0f,+fSeitenL/2.0f); glTexCoord2f(1.f, -1.f); glVertex3f(+fSeitenL/2.0f,-fSeitenL/2.0f,+fSeitenL/2.0f); glTexCoord2f(1.f, 0.0f); glVertex3f(+fSeitenL/2.0f,+fSeitenL/2.0f,

problem loading texture with transparency with OpenGL ES and Android

跟風遠走 提交于 2019-12-11 07:00:21
问题 Im trying to load an image that has background transparency that will be layered over another texture. When i try and load it, all i get is a white screen. The texture is 512 by 512, and its saved in photoshop as a 24 bit PNG (standard PNG specs in the Photoshop Save for Web and Devices config window). Any idea why its not showing? The texture without transparency shows without a problem. Here is my loadTextures method: public void loadGLTexture(GL10 gl, Context context) { //Get the texture

MATLAB Anonymous function handle to use with NLFILTER

一笑奈何 提交于 2019-12-11 06:58:27
问题 I have the following function which calculates a GLCM and then a given statistic parameter. I would like to pass this function to NLFILTER to do the calculation for a whole image (in small windows, e.g. convolution). I already have then NLFILTER set up to run using the parallel computing toolbox, so I would really like to convert the function I have below: function [s]=glcm(img,meth) %GLCM calculates a Gray Level Co-occurence matrix & stats for a given sub % image. % Input: Sub Image (subI)

OpenGL, how to set a monochrome texture to a colored shape?

柔情痞子 提交于 2019-12-11 06:37:01
问题 I'm developing on Android with OpenGL ES, I draw some cubes and I change their colors with glColor4f. Now, what I want is to give a more realistic effect on the cubes, so I create a monochromatic 8bit depth, 64x64 pixel size PNG file. I loaded on a texture, and here is my problem, which is the way to combine the color and the texture to get a colorized and textured cubes onto the screen? I'm not an expert on OpenGL, I tried this: On create: public void asignBitmap(GL10 gl, Bitmap bitmap) {

QPainter how draw texture with special color

馋奶兔 提交于 2019-12-11 06:30:00
问题 I have some patterns which are black with alpha and have some points that I want to draw line with patterns. I find QBrush can be constructed by texture, but I don't know how to draw it with difference colors. This answer show a way here in C# code, but I don't know how to change patterns color with ColorMatrix. 回答1: The modification of RGBA values of an image using a 5×5 color matrix reminds me to the transformation of homogeneous coordinates how it is often used in computer graphics. If you

OpenGl texture goes too dark

六眼飞鱼酱① 提交于 2019-12-11 05:50:54
问题 Basically I have a render function which draws a rectangle using textures: glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glShadeModel(GL_SMOOTH); glEnable(GL_TEXTURE_2D); glShadeModel(GL_SMOOTH); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glBindTexture(GL_TEXTURE_2D, texture[0]); glBegin(GL_QUADS); { glTexCoord2f(0, 0); glVertex3f(points[0]->x, points

Mapping texture on 3DS VAO turns out mirrored

徘徊边缘 提交于 2019-12-11 05:50:06
问题 I implemented a 3ds modelloader following this tutorial. Currently my program uses VAOs do display things. This worked so far for simple cubes and tiles. Textures were displaying correctly. However, when I load the 3DS model into a VAO its a different sotry. The model looks correct concerning the vertices, but the texture is mirrored along the Y axis for some reason. This is how i read the UV: case 0x4140: qty = reader.ReadUInt16(); // 2 bytes UV[] texcoords = new UV[qty]; for (i = 0; i < qty

How to clip the texture in rounded shape

為{幸葍}努か 提交于 2019-12-11 05:42:35
问题 I need to display texture of image with the rounded shape,my code as follow texture = Texture.FromBitmap(device,myBitmap, Usage.RenderTarget, Pool.Default); _sprite.Begin(SpriteFlags.SortTexture | SpriteFlags.DoNotModifyRenderState); _sprite.Draw(_allocator.Texture, Vector3.Empty, new Vector3(_objectLocation.X, _objectLocation.Y, 0), RenderingColor); _sprite.End(); But it always show rectangle texture, how can clip this texture in rounded shape. 回答1: Use the alpha channel of the texture (255

How do base internal formats work?

左心房为你撑大大i 提交于 2019-12-11 05:26:45
问题 The glTexImage2D function accepts, among others, the so-called "base internal formats" listed below: GL_DEPTH_COMPONENT GL_DEPTH_STENCIL GL_RED GL_RG GL_RGB GL_RGB These appear to lack any type or size information. Quoting the documentation: If an application wants to store the texture at a certain resolution or in a certain format, it can request the resolution and format with internalFormat. The GL will choose an internal representation that closely approximates that requested by

Texture units and vertex arrays in OpenGL

☆樱花仙子☆ 提交于 2019-12-11 04:57:59
问题 I'm trying to draw one cube with different textures for each face. I've come across many tutorials which state that in the display() routines, you need to enable all texture units before calling glDrawElements() . I do this my calling: gl.glClientActiveTexture(GL.GL_TEXTURE0); gl.glBindTexture(GL.GL_TEXTURE_2D, textureId); gl.glBindBuffer(GL.GL_ARRAY_BUFFER, getTexCoordBufferObject()); gl.glTexCoordPointer(2, GL.GL_FLOAT, 0, 0); gl.glClientActiveTexture(GL.GL_TEXTURE1); gl.glBindTexture(GL.GL