textures

Text not rendering correctly - OpenGL using FreeType2

帅比萌擦擦* 提交于 2019-12-18 09:02:30
问题 Almost exact duplicate question: OpenGL font rendering using Freetype2. I am trying to render text in my OpenGL program using FreeType2 (2.5.3), based on this tutorial: http://en.wikibooks.org/wiki/OpenGL_Programming/Modern_OpenGL_Tutorial_Text_Rendering_02, using the same structs as Bentebent did in his question (above). I am having the same problem he was having with rectangles showing up instead of legible characters (even using the correct GL_TEXTURE0 parameter for glActiveTexture() ) For

glGetTexImage reads too much data with texture format GL_ALPHA

一个人想着一个人 提交于 2019-12-18 07:04:50
问题 I'm trying to retrieve the pixel information for an alpha-only texture via glGetTexImage. The problem is, the glGetTexImage-Call seems to read more data than it should, leading to memory corruption and a crash at the delete[]-Call. Here's my code: int format; glGetTexLevelParameteriv(target,0,GL_TEXTURE_INTERNAL_FORMAT,&format); int w; int h; glGetTexLevelParameteriv(target,0,GL_TEXTURE_WIDTH,&w); glGetTexLevelParameteriv(target,0,GL_TEXTURE_HEIGHT,&h); if(w == 0 || h == 0) return false; if

What exactly is a floating point texture?

笑着哭i 提交于 2019-12-18 03:18:33
问题 I am trying to wrap my head around floating point textures, but I am finding it hard to find any good resources which explain them to me.. I tried reading the OpenGL ARB_texture_float spec, but I still cannot get it in my head.. And how is floating point data related to just normal 8-bit per channel RGBA or RGB data from an image that I am loading into a texture? Thanks for the help and any sort of information related to my question!! 回答1: Here is a read a little bit here about it. Basically

OpenGL Lighting on texture plane is not working

主宰稳场 提交于 2019-12-17 22:28:22
问题 I want to light to the texture plane but this is not work. Light on solid sphere is very well, but texture plane is not light. Whole Image Lighting on solid-sphere is working well. But, lighting on texture plane is not working. (GL_DECAL, GL_REPLACE; I also tried GL_MODULATE) This is a snippet of my rendering code. (Whole code on GitHub) Loading texture. sf::Image image; if (!image.loadFromFile(path)) return false; glGenTextures(1, &id); glBindTexture(GL_TEXTURE_2D, id); glTexImage2D( GL

make seamless height-map texture for sphere (planet)

蓝咒 提交于 2019-12-17 21:34:28
问题 I'm trying to generate height-map for spherical planet with perlin noise. How can I make it with seamless left/right borders? I smoothed heightmap in poles, but cannot understand how can I loop left and right sides. This is how my textures look liked for now: 回答1: Mirroring (by y-axis) This is great for making seamless background textures. But as you mentioned the texture must not contain distinct patterns otherwise it would be obvious. This can be used as a start point for texture generator

Extruding multiple polygons with multiple holes and texturing the combined shape

我的梦境 提交于 2019-12-17 19:53:42
问题 This question is related to this question. The answer shows very nice way to extrude polygons that have holes (see the excellent live example). The main learning of the answer was that paths in three.js (r58) cannot have more than one moveTo command and it have to be in the start of the path, which means that path have to be broken by moveTos, so that moveTo start always a new path. Extruding in three.js means that 2D paths are converted to 3D shapes using possible beveling. It is suitable

Can I use a grayscale image with the OpenGL glTexImage2D function?

做~自己de王妃 提交于 2019-12-17 19:38:01
问题 I have a texture which has only 1 channel as it's a grayscale image. When I pass the pixels in to glTexImage2D, it comes out red (obviously because channel 1 is red; RGB). glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, dicomImage->GetColumns(), dicomImage->GetRows(), 0, GL_RGBA, GL_UNSIGNED_BYTE, pixelArrayPtr); Do I change GL_RGBA? If so, what to? 回答1: Change it to GL_LUMINANCE. See http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/teximage2d.html 回答2: It appears that I

What are the usual troubleshooting steps for OpenGL textures not showing?

时光怂恿深爱的人放手 提交于 2019-12-17 19:34:13
问题 After making a few changes in my application, my textures are no longer showing. So far I've checked the following: The camera direction hasn't changed. I can see the vectors (when colored instead of textured). Any usual suspects? 回答1: You may want to check the following: glEnable(GL_TEXTURE_2D); presence glBindTexture(GL_TEXTURE_2D, texture[i]); and glBindTexture(GL_TEXTURE_2D, 0); when you don't need texture anymore 回答2: A few more things to check: glColorMaterial(...); To make sure colors

Can a three.js material have separate repeat values for a bump map and a texture map?

喜欢而已 提交于 2019-12-17 19:29:36
问题 I'm trying to break up the repetition in my texture by applying a bump map which repeats much less frequently. Unfortunately, it seems to take on the repeat value of 'landTexture' below (64), instead of the value I set it to (1). landTexture.wrapS = landTexture.wrapT = THREE.RepeatWrapping; landTexture.repeat.set(64, 64); bumpTexture.wrapS = bumpTexture.wrapT = THREE.RepeatWrapping; bumpTexture.repeat.set(1, 1); var m = new THREE.MeshPhongMaterial({map:landTexture, ambient: 0x552811, specular

How to save bitmap from GLSurfaceView (Only bitmap, not whole texture)

牧云@^-^@ 提交于 2019-12-17 18:59:48
问题 I am using this code to give multiple effect on bitmap that is on GlSurfaceView. apply-effects-on-image-using-effects Now, I want to save the bitmap. They have given the code to save the bitmap but with that, whole GlSurfaceView is going to be saved as bitmap image. Instead I want to save only bitmap area to save as Image. There is method that takes pixels and make bitmap from that and also make image. e.g.: public Bitmap takeScreenshot(GL10 mGL) { final int mWidth = mEffectView.getWidth();