textures

WebGL blit texture to canvas

╄→尐↘猪︶ㄣ 提交于 2019-12-24 01:33:10
问题 What is the cleanest way of blitting a texture to the HTML canvas in WebGL. I could see setting up an orthographic projection and rendering a textured quad, but is there a cleaner way? 回答1: What to mean "blitting a texture to the HTML5 Canvas"? Do you mean just drawing a texture 1x1 pixel to the canvas? No need for a orthographic projection. The simplest thing is either make a unit quad and scale or make a quad in pixel coords and draw. Here's the pixel coord quad shader attribute vec2 a

Render a section of an image to a Bitmap C# Winforms

霸气de小男生 提交于 2019-12-24 00:54:47
问题 I'm working on a Map Editor for an XNA game I'm designing in my free time. The pieces of art used in the map are stored on a single texture and rectangles are stored with coordinates and widths etc. In the winforms application I can add segments by selecting the segment I want from a listbox, which is populated from the array of possible segments. Problem is I would like to be able to show a preview of the segment selected and, since it is stored on a common texture, I cant simply set a

Drawing text as textures on squares does not show anything

本小妞迷上赌 提交于 2019-12-24 00:04:12
问题 I'm new to OpenGL and I'm developing an Augmented-reality application for Android. Until now, I was drawing white squares, perpendicular to the camera, pointing the user to the direction where a "Point of interest" would be. Now, I'm trying to show some text into the squares. I've read a lot and it seems that creating a texture with the text is the most direct and easiest approach, so I'm creating the textures as soon as I get data of the Points of interest and stick them to their squares.

How are `glTexEnv`, `glColor4x` and `glBlendFunc` related in OpenGL ES 1.0?

一个人想着一个人 提交于 2019-12-23 20:56:48
问题 I'm looking at SurfaceFlinger, i.e. the the code that is doing the composition in Android, and I have trouble understanding some of the OpenGL ES 1.0 calls as I've only programmed ES 2.0 code. Here goes the piece of code that interests me: glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); glColor4x(0x10000, 0x10000, 0x10000, 0x10000); glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); What it is supposed to be doing is blending a texture into the buffer. Why does one

how to detect if openGL/card supports non power of 2?

本小妞迷上赌 提交于 2019-12-23 19:42:46
问题 What is the best way to detect if a graphics card and compiled openGL binary supports textures which are not a power of 2 at run time? 回答1: You can check with glGet for ARB_texture_non_power_of_two or use GLEW. Edit to reflect the comments: As of OpenGL 2.0 this feature is required and ARB_texture_non_power_of_two need not be defined. How to find the current version is described here. As Jerry points out: Depending on the GPU the feature might be implemented in software and the performance

Loading texture from Web Worker in Three.js

为君一笑 提交于 2019-12-23 16:36:50
问题 When applying a large texture image to a Mesh for a noticeable period of time Three.js locks-up browser's main thread. Let's consider the following example: var texLoader = new THREE.TextureLoader(); texLoader.load('someLargeTexture.jpg', function(texture) { var geometry = new THREE.SphereGeometry(10, 32, 32); var material = new THREE.MeshBasicMaterial({map: texture}); var sphere = new THREE.Mesh(geometry, material); // adding the object to the scene will lock up the browser's main thread

Can linear filtering be used for an FBO blit of an MSAA texture to non-MSAA texture?

☆樱花仙子☆ 提交于 2019-12-23 16:34:22
问题 I have two 2D textures. The first, an MSAA texture, uses a target of GL_TEXTURE_2D_MULTISAMPLE . The second, non MSAA texture, uses a target of GL_TEXTURE_2D . According to OpenGL's spec on ARB_texture_multisample, only GL_NEAREST is a valid filtering option when the MSAA texture is being drawn to. In this case, both of these textures are attached to GL_COLOR_ATTACHMENT0 via their individual Framebuffer objects. Their resolutions are also the same size (to my knowledge this is necessary when

Three.js: Distant objects are faint

限于喜欢 提交于 2019-12-23 16:34:12
问题 I'm working on a three.js scene that renders some textured point sprites. Those sprites get their textures from a single uniform , and that uniform is a 2D canvas on which I've drawn the letters of the alphabet: While all the letters are rendered on this canvas in black, points in the three.js scene that are far from the camera appear quite faintly in my scene: // aliases var BA = THREE.BufferAttribute, IBA = THREE.InstancedBufferAttribute, ARR = Float32Array; function Wordmap() { // config

How to flip a texture within beginNativePainting()?

时光怂恿深爱的人放手 提交于 2019-12-23 16:09:13
问题 I'm writing a class that inherits from QGLWidget : class GLWidget : public QGLWidget { Q_OBJECT public: GLWidget(QWidget *parent = 0); ~GLWidget(); void paintEvent(QPaintEvent *event); private: QImage* _frame; }; The constructor of GLWidget loads an image from the disk, and paintEvent() is responsible to send the data to the GPU using native OpenGL calls that are executed between beginNativePainting() and endNativePainting() , and this works OK. The problem is that the image is being

three.js cube black but i added texture?

我的梦境 提交于 2019-12-23 12:18:03
问题 I tried adding texture to my cube I made using JS/THREE.JS. But when I open it up in my browser its all black? This is my code: <html> <head> <title>My first Three.js app</title> <style>canvas { width: 100%; height: 100% }</style> </head> <body> <script src="https://rawgithub.com/mrdoob/three.js/master/build/three.js"></script> <script> // revolutions per second var angularSpeed = 0.2; var lastTime = 0; // this function is executed on each animation frame function animate(){ // update var