textures

LibGdx texture drawn as inverse of what #getTextureData gives

梦想与她 提交于 2019-12-02 09:50:19
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.getTextureData(); td.prepare; Pixmap map = td.consumePixmap(); for (int i = 0; i < map.getWidth(); i++)

A red rectangle drawn on 2D texture disappears right after being drawn

懵懂的女人 提交于 2019-12-02 09:42:12
following my another question , I have provided the code that draws the rectangle as follows: void COpenGLControl::DrawRectangleOnTopOfTexture() { wglMakeCurrent(hdc, hrc); glPushAttrib(GL_ENABLE_BIT|GL_CURRENT_BIT); glDisable(target); glColor3f(1.0f,0.0f,0.0f); glBegin(GL_LINE_LOOP); glVertex2f(RectangleToDraw.at(0),RectangleToDraw.at(1)); glVertex2f(RectangleToDraw.at(0),RectangleToDraw.at(3)); glVertex2f(RectangleToDraw.at(2),RectangleToDraw.at(3)); glVertex2f(RectangleToDraw.at(2),RectangleToDraw.at(1)); glEnd(); glPopAttrib(); SwapBuffers(hdc); wglMakeCurrent(NULL, NULL); } void

Creating texture from getImageData (Javascript)

百般思念 提交于 2019-12-02 09:09:29
问题 It is possibile to create a texture (to use on a element in a canvas) from the getImageData array of another canvas (in the same html page)? maybe without three.js? Thanks a lot, Jennifer 回答1: The coolest thing about WebGL's texImage2D method is that its last argument can be a DOM element instead of an ArrayBuffer, in which case it copies its rendered content into your texture object. For example: var canvas2d = document.getElementById('canvas2d'); gl.bindTexture(gl.TEXTURE_2D, myTexture); gl

Copy Texture to Texture

守給你的承諾、 提交于 2019-12-02 08:29:18
I've done 2 programs to use Shared Resources, running on SlimDX & DirectX10. One program will display the shared texture on a 3D mesh. The 2nd program will load an image as texture. So far I need to pass the shared handled everytime the texture is update from a new image. Now, is there a way that I can initialize a fixed size shared texture (Texture2D), then everytime when I load a new image, all I need to do is load it as texture, then copy it to the existing texture. This way the shared handle would not change, and I can save some overhead of passing the shared handle. For DirectX9, I do

Is three.js ObjectLoader capable of loading textures?

邮差的信 提交于 2019-12-02 08:21:16
three.js version 0.0.70, blender version 2.73a I have a scene exported from blender to three.js json format using new io_three (not io_three_mesh ) exporter. I'm able to import the scene into three.js using ObjectLoader : var objectLoader = new THREE.ObjectLoader(); objectLoader.load('assets/models/exportedScene.json', function(imported) { scene.add(imported); }); Unfortunatelly, no texture is applied to an object, only the material. As I see from exportedScene.json file, there is an info about texture in file: "images": [{ "url": "blue.jpg", "uuid": "DFE5BBBF-601B-48EA-9C05-B9CB9C07D92E",

Render an outlined red rectangle on top a 2D texture in OpenGL

亡梦爱人 提交于 2019-12-02 06:30:32
I have searched alot this site but couldn't exactly find what is exactly my problem. Most of the similar problems had used console and the glut library. But since I'm new to OpenGL and MFC and started it with the combination of MFC, they couldn't help me alot. I'm customizing the class COpenGLcontrol here in codeguru for my own purposes. Here's the full customized class but if you're not interested in downloading it, no problem I will explain the parts that are related. This may take a while, so I hope you will be patient! First of all I should tell you that my goal of drawing such a rectangle

Creating texture from getImageData (Javascript)

孤街醉人 提交于 2019-12-02 06:03:11
It is possibile to create a texture (to use on a element in a canvas) from the getImageData array of another canvas (in the same html page)? maybe without three.js? Thanks a lot, Jennifer The coolest thing about WebGL's texImage2D method is that its last argument can be a DOM element instead of an ArrayBuffer, in which case it copies its rendered content into your texture object. For example: var canvas2d = document.getElementById('canvas2d'); gl.bindTexture(gl.TEXTURE_2D, myTexture); gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true); gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED

OpenGL ES 2.0 GLSL texture2D return value when unbound

时光总嘲笑我的痴心妄想 提交于 2019-12-02 03:22:17
问题 In the following code: gl_FragColor = vColor * texture2D(u_Texture, v_TexCoordinate); I noticed the default value returned by texture2D is a white (1,1,1,1) if u_Texture is unbound. Is it safe to base my shader on this fact? 回答1: I wouldn't have thought so. I have seen other instances where the default value has been black. It could theoretically be any colour in the case where the memory used by the sampler is a section of uninitialised video memory, it depends on the opengl implementation

Using texture for triangle mesh without having to read/write an image file

淺唱寂寞╮ 提交于 2019-12-02 01:59:50
问题 This is a followup on a previous question (see Coloring individual triangles in a triangle mesh on javafx) which I believe is another topic on its own. Is there a way (with javafx) that I can get away from having to actually write to disk (or external device) an image file to use a texture? In other words: can I use a specific texture without having to use Image? Since my color map will change on runtime I don't want to have to write to disk every time I run it. Also, this might be a security

Scroll 2D/3D background via texture offset

浪尽此生 提交于 2019-12-02 01:26:17
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. Select the original Texture not the GameOBject. 1 . Change Texture Type to Texture . 2 . Change Wrap Mode to Repeat . 3 . Click