textures

Linear/Nonlinear Texture Mapping a Distorted Quad

北战南征 提交于 2019-12-08 17:54:11
问题 In my previous question, it was established that, when texturing a quad, the face is broken down into triangles and the texture coordinates interpolated in an affine manner. Unfortunately, I do not know how to fix that. The provided link was useful, but it doesn't give the desired effect. The author concludes: "Note that the image looks as if it's a long rectangular quad extending into the distance. . . . It can become quite confusing . . . because of the "false depth perception" that this

Display a numpy array in Kivy

吃可爱长大的小学妹 提交于 2019-12-08 17:24:57
问题 first of all, I'm totally new to kivy, so I'm struggling a bit. I'm trying to display a numpy array in a kivy window. So far i figured out that this should work using the Texture Class (http://kivy.org/docs/api-kivy.graphics.texture.html). As my numpy array changes from time to time, I'm trying to adjust the following code to my application. # create a 64x64 texture, defaults to rgb / ubyte texture = Texture.create(size=(64, 64)) # create 64x64 rgb tab, and fill with values from 0 to 255 # we

Binding textures in OpenGL

人走茶凉 提交于 2019-12-08 14:50:26
问题 So I'm rendering my scene in batches, to try and minimize state changes. Since my shaders usually need multiple textures, I have a few of them bound at the same time to different texture units. Some of these textures are used in multiple batches, so could even stay bound. Now my question is, is it fine to just re-bind all of the textures that I need during a batch, even though some of them may already be bound? Or should I check which ones are bound, and only bind new ones? How expensive is

internal format related to texture2D() in GLSL and glTexImage2D() in OpenGL

女生的网名这么多〃 提交于 2019-12-08 11:03:52
问题 I am confused with the internal format related to texture2D() in GLSL and glTexImage2D() in OpenGL, When I use(pay attention to the third and the eighth parameters): glTexImage2D(GL_TEXTURE_2D, 0,GL_RGBA16F_ARB, WINDOW_SIZE, WINDOW_SIZE, 0, GL_RGBA, GL_FLOAT, floatDataPtr); I got the nonclampedvalue of sampler2D in the glsl without clamped to [0, 1]: vec4 nonclampedvalue = texture2D(my16floattex2d, texcoord1); When I use: glTexImage2D(GL_TEXTURE_2D, 0,GL_RGBA8, WINDOW_SIZE, WINDOW_SIZE, 0, GL

Draw texture according to viewport and camera

陌路散爱 提交于 2019-12-08 10:12:01
问题 I don't manage to draw my textures so that they are resized according to the screen resolution. I am using ScreenViewport (as I want my font to be smooth and without distorsion). float w = Gdx.graphics.getWidth(); float h = Gdx.graphics.getHeight(); gameCam = new OrthographicCamera(2f * h/w, 2f); gamePort = new ScreenViewport(gameCam); Weirdly, whatever the height and width of the camera the result is the same. In the resize method, I tried a lot of things : @Override public void resize(int

How to cache complex item into texture and release the memory for the actual complex item?

我怕爱的太早我们不能终老 提交于 2019-12-08 06:38:20
问题 I've got a big number of items that are quite complex (memory-heavy), and in order to fit in limited RAM, I want to cache some of them into textures and not keep the actual complex item in memory. In particular, items for which I want to do that are all those (among my complex items) that do not currently need to animate (and this means most of them). For the purposes of this question I call this kind of items "inactive". My plan was: When an item "foo" becomes inactive: Create dynamically a

XNA to render 3D video (fixed FPS!)

我们两清 提交于 2019-12-08 06:02:10
问题 i have to develop an application in wich the final step is to export a video (or a single frame) of a 3D animation generated by my software calculating the user input parameters. I want to use XNA and for this. i need that the software can export FIXED FPS video (or also all single frames of the video separately). It's not a matter the LIVE FPS. I don't need to view on the screen the frames at a fixed fps. As the animation could be very complex, i could accept if the software take 1 minute

How to draw a circle on 3D terrain in XNA?

こ雲淡風輕ζ 提交于 2019-12-08 05:46:14
问题 So I've been looking across the web to find an answer to this question, but I seem to be missing something. I've got a little project going that dynamically creates 3D terrain in XNA 4.0, but I want be able to draw a circle (or any other shape for that matter, but let's first go with a circle) on the terrain. Now I've read some things about 'projective texturing' but I'll admit I'm at a complete loss when it comes to shader-language. The idea is that I can (dynamically) create a basic shape,

Empty texture when using glTexImage2D with ByteBuffer in LWJGL

大憨熊 提交于 2019-12-08 04:55:15
问题 I just got a test texture working in my LWJGL code using an array of float s. Now, though, I need to load an image from a file and store it in the texture. I have gotten the image loaded and the data into a ByteBuffer object, but when I use glTexImage2D like so: GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGB, 4, 4, 0, GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, buffer); the texture is empty and will render as completely black. I've looked at how other people do this but nothing seems to be

Tiling texture bmp file as texture onto a rectangle in OpenGL?

旧街凉风 提交于 2019-12-08 04:42:55
问题 I have a pic.bmp that I'm attempting to tile onto a 3 x 2 rectangular flat surface for a demo I'm making. I'm attempting to keep the aspect ratio of the bmp in tact but I still want to tile it across that surface. Right now I have the surfaces vertices as (0,0,0), (3,0,0), (0,2,0) and (3,2,0). How can I apply this bmp to the flat surface and tile it? What is the best way to do this in GLUT & OpenGL? 回答1: See this NeHe lesson for a sample. To do tiling just write something like this: glBegin