textures

How to create Stencil buffer with texture (Image) in OpenGL-ES 2.0

痞子三分冷 提交于 2019-11-30 19:59:41
Can I have Stencil prepared with a texture (Image) in OpenGL 2.0 So that some part of the Image will be transparent and as a result it will be transfered as is to Stencil buffer and then will use this use this stencil buffer for further drawing. EDIT by datenwolf to account for OPs question update in a answer: By @InfiniteLoop: @datenwolf thanks a lot for ur reply but no success :( here is my code - (void)render { [EAGLContext setCurrentContext:context]; glBindFramebuffer(GL_FRAMEBUFFER, defaultFramebuffer); glUseProgram(program); glClearColor(0, 104.0/255.0, 55.0/255.0, 1.0); glViewport(0, 0,

OpenGL ES; rendering texture created from CGBitmapContext

早过忘川 提交于 2019-11-30 19:46:52
问题 I am executing the following, which I have derived from a few different tutorials (Just a single render pass, initialisation code not shown but works fine for untextured primitives): glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrthof(0, xSize, 0, ySize, -1.0f, 1.0f); glMatrixMode(GL_MODELVIEW); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glEnable(GL_TEXTURE_2D); glBlendFunc(GL_ONE, GL_SRC_COLOR); GLuint texture[1]; glGenTextures(1, &texture[0]); glBindTexture(GL_TEXTURE_2D, texture[0]);

How to change single texel in OpenGL texture

别说谁变了你拦得住时间么 提交于 2019-11-30 19:43:46
I want to change the some texels in a OpenGL texture for a given location. Can anyone help me with this pls ? This is the functionnality that I want, void ChangeTexelColor(int x, int y, GLuint id, int texW, int texH, GLenum format) { //What is here ? } This will use to maintain the minimap of my game (if anyone have a better idea of maintaining a dynamic map-texture-). Btw, this must done fast. Thanks. OpenGL has the glTexSubImage2D function, which is exactly for your purpose. Here's a functions that changes the color of one texel: void changeTexelColor(GLuint id, GLint x, GLint y, uint8_t r,

WebGL importing models using the OBJMTLoader in three.js fails

老子叫甜甜 提交于 2019-11-30 19:27:38
问题 I am having some problems trying to import the following model into WebGL using three.js: http://tf3dm.com/3d-model/vanille-99084.html I've converted the obj file to JSON using the converter that comes with three.js and the model works fine when using the JSON Loader. However, when trying to load the model with the textures from the .mtl file the OBJMTLOader fails. I am using the following example and just replaced the paths with the paths to my files: https://github.com/mrdoob/three.js/blob

Animating Canvas Billboard in THREE.js

风流意气都作罢 提交于 2019-11-30 18:53:16
Everyone, I'm trying to animate a Canvas-based texture that is mapped onto a plane, like a billboard. I've made a point of including material.needsUpdate & texture.needsUpdate , but I'm still unable to get the texture to come to life. I've also included a rotating cube just so I know the animation routine is functioning on some level. Here is the code: if ( window.innerWidth === 0 ) { window.innerWidth = parent.innerWidth; window.innerHeight = parent.innerHeight; } var camera, scene, renderer; var mesh, geometry, material; var light, sign, animTex; var canvas, context; init(); animate();

dart:web_gl: RENDER WARNING: texture bound to texture unit 0 is not renderable

[亡魂溺海] 提交于 2019-11-30 18:39:06
I'm getting the error [.WebGLRenderingContext]RENDER WARNING: texture bound to texture unit 0 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering or is not 'texture complete' when I run my web app in dartium. I've been trying to troubleshoot this issue for two days, including a full rewrite of the code, But I can't isolate the issue. I think the problem lies in this piece of code, however. void main() { ... var texture = gl.createTexture(); var image = new ImageElement(); image.onLoad.listen((e) { gl.bindTexture(webGL.TEXTURE_2D, texture); gl.texImage2DImage

Floating Point Textures in OpenGL ES 2.0

安稳与你 提交于 2019-11-30 18:33:58
I've been trying to figure out how to use float textures in GLES2. The API Reference ( http://www.khronos.org/opengles/sdk/docs/man/glTexImage2D.xml ) says that only unsigned bytes and shorts can be used, but i've seen people saying it is supported elsewhere. I could use GL_LUMINANCE as the texture format but that only gets me one float value. If anyone has some insight i'd appreciate it. In OpenGL ES 2.0, floating-point textures are only supported if the implementation exports the OES_texture_float extension. Note that this extension only allows nearest filtering within a texture level, and

texturing a glutSolidSphere

孤街浪徒 提交于 2019-11-30 18:10:37
问题 I need to add an earth texture to a glutSolidSphere. The problem is that I cannot figure out how to make the texture stretch over the entire sphere and still be able to rotate. We're enabling the textures with. glTexGeni(GL_S, GL_TEXTURE_GEN_MODE,GL_OBJECT_LINEAR); glTexGeni(GL_T, GL_TEXTURE_GEN_MODE,GL_OBJECT_LINEAR); glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); //drawcode... using GL_SPHERE_MAP in param instead of GL_OBJECT_LINEAR makes the textures look

CUDA Texture Linear Filtering

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 18:07:55
问题 In the CUDA C Programming Guide Version 5, Appendix E.2 (Linear Filtering), it is stated that: In this filtering mode, which is only available for floating-point textures , the value returned by the texture fetch is... The part in bold case is confusing me. Does floating point mean the texel type only, or the return type also? For example, I declare 3 textures as follows. texture<float,cudaTextureType2D> tex32f; texture<unsigned char, cudaTextureType2D, cudaReadModeNormalizedFloat> tex8u;

opengl create a depth_stencil texture for reading

房东的猫 提交于 2019-11-30 16:08:54
I'm using defered rendering in my application and i'm trying to create a texture that will contain both the depth and the stencil. glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8, width, height, 0, ???, GL_FLOAT, 0); Now what format enum does opengl want for this particular texture. I tried a couple and got error for all of them Also, what is the correct glsl syntax to access the depth and stencil part of the texture. I understand that depth texture are usually uniform sampler2Dshadow. But do I do float depth = texture(depthstenciltex,uv).r;// <- first bit ? all 32 bit ? 24 bit ? float