textures

How do I load textures to OpenGL using FreeImage library?

风流意气都作罢 提交于 2019-12-20 10:44:07
问题 I'm learning OpenGL in C++ using NeHe tutorials, but I'm trying to do them with FreeImage library, instead of Glaux or SOIL. The good point I see in using FreeImage is thar it's last update was in October last year, while SOIL hasn't been updated in 5 years. The problem I have is that I'm not able to load textures correctly. Here is my code: static GLuint texture = 0; if (texture == 0) { FIBITMAP* bitmap = FreeImage_Load( FreeImage_GetFileType("textures/test/nehe_06.png", 0), "textures/test

how to manage memory with texture in opengl?

一笑奈何 提交于 2019-12-20 08:43:24
问题 In my application I am using extensively glTexImage2D. I copy some image of an image and render it as a texture, I do it frequently at every mouse click. I give it as a byte array for rendering. The memory is being eaten up and the swap memory is also allocated. Is it a memory leak? or is it due to the fact that glTexImage2D holds any references or anything else. Edit: //I allocate the memory once GLuint texName; texture_data = new GLubyte[width*height]; // Each time user click I repeat the

LibGdx texture drawn as inverse of what #getTextureData gives

ⅰ亾dé卋堺 提交于 2019-12-20 06:11:31
问题 I've been trying to resolve this issue I have been having with displaying a texture correctly on my libgdx desktop program. I have an Orthographic camera with which when I set as: camera.setOrtho(false); I get this image: And when I set it as: camera.setOrtho(true); I get this image: The red image is drawn with a SpriteBatch: batch.draw(texture, x, y, width, height); While the white image is drawn from individual points plotted based on if their alpha value was 1. TextureData td = texture

Problems texturing a cube

大兔子大兔子 提交于 2019-12-20 03:31:27
问题 im trying to make a cube with a different texture on each face. I have the front face and the rear face working now. Now i am trying to make the right face of the cube. But something is going wrong, because i got the right face done but the texture is showing with errors (it's like stretched and shredded), i have something bad in my code and i dont know what. This is my code public class Cube { private FloatBuffer vertexBuffer;//Vertices private FloatBuffer textureBuffer;//Texture coordinates

Android OpenGL ES2.0 Texture Swapping

旧巷老猫 提交于 2019-12-20 03:21:32
问题 First off I am new to OpenGL, but on my phone (Motorola Bionic) the following code works as intended. GLES20.glActiveTexture(GLES20.GL_TEXTURE1); GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTowerTextureHandle); GLES20.glActiveTexture(GLES20.GL_TEXTURE2); GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTowerNormalHandle); GLES20.glActiveTexture(GLES20.GL_TEXTURE3); GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mFrostTextureHandle); GLES20.glActiveTexture(GLES20.GL_TEXTURE4); GLES20.glBindTexture

Scroll 2D/3D background via texture offset

浪子不回头ぞ 提交于 2019-12-20 02:55:06
问题 I have been trying to make an infinite scrolling 2D background in Unity using a quad to display a Texture. My idea was to change the offset of the quad depending on the player's position. For some reason when I change the offset my image does not repeat properly and once an offset of 2 has been reached completely disappears. An image of 3 different x offset values on my texture If anyone knows how to fix this if you could get back to me it would be much appreciated. 回答1: Select the original

OpenGL ES: How to tint texture with color

天涯浪子 提交于 2019-12-19 19:52:22
问题 I have texture with alpha. And I want to tint it with some color, so it will be colored depending on color alpha value, but overal opacity will be defined only by texture alpha. This is similar to multi-texturing but with color instead of second texture. How to do it? (Updated) I have tried to set up texture combiner. Color is tinted fine, but there is problem with alpha - it doesn't take value from texture (like mask). My code at this moment: glActiveTexture (GL_TEXTURE0); // do we need

Repeated textures are severely distorted/shaking when rotating camera

社会主义新天地 提交于 2019-12-19 18:57:34
问题 I originally asked this question on gamedev, but none of the answers helped to solve problem, and I still have no clue what is the real cause. I didn't see anything about re-posting questions across SE in FAQs, so I can only hope this is okay. Moreover, in the retrospect the question is probably more related to graphics programming in general than just game development. Edit 1 begins The behaviour of the original post applies only to Windows XP and Windows 7, browsers Firefox and Chrome. On

Non-radial texture mapping over a ring geometry in WebGL using Three.js

最后都变了- 提交于 2019-12-19 10:41:21
问题 I am trying to simulate image deformation effects using textures over 2D geomtries using the ThreeJS library. I want to apply a texture image over a hollow circle (basically, a ring built by the THREE.RingGeometry function) and obtain the results shown at this image: Following I show the results I am obtaining in my scene both for the solid ring and its wireframed version: The problem is that, as you see, the texture is been applied in a radial way, from the center of the ring to the outside.

WebGL Depth Texture all white?

给你一囗甜甜゛ 提交于 2019-12-19 10:27:19
问题 I'm using the WEBGL_depth_texture in chrome to render a scene to a framebuffer with a color and depth texture. When I display my color texture works fine, but my depthtexture is all white. Shouldn't it be like gray? my draw texture function: this.drawTexture = function() { //gl.viewport(0, 0, this.canvas.width, this.canvas.height); gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); gl.bindBuffer(gl.ARRAY_BUFFER, this.vertBuffer); gl.vertexAttribPointer(this.VertexPosition, 2, gl.FLOAT,