textures

Textured spheres without strong distortion

会有一股神秘感。 提交于 2019-12-03 14:17:11
I've seen well-textured balls, planets, and other spherical objects in couple of games, last time in UFO: aftermath. If you just splatter a texture into latitude/longditude as u and w -coordinates you'll get lots of ugly texture distortion to poles. I can think myself an one way to implement a spherical map with minimum distortion. By mapping in triangles instead of squares. But I don't know any algorithms. How to produce vertices and texture coordinates for such spheres? Also, I don't see a way to generate a complete spherical map from a simple flat square map. Is there some intuitive way on

setting up a CUDA 2D “unsigned char” texture for linear interpolation

做~自己de王妃 提交于 2019-12-03 13:55:51
问题 I have a linear array of unsigned chars representing a 2D array. I would like to place it into a CUDA 2D texture and perform (floating point) linear interpolation on it, i.e., have the texture call fetch the 4 nearest unsigned char neighbors, internally convert them to float, interpolate between them, and return the resulting floating point value. I am having some difficulty setting up the texture and binding it to a texture reference. I have been through the CUDA reference manual &

Tips for improving OpenGL ES fill rate on Android

為{幸葍}努か 提交于 2019-12-03 13:46:36
In my live wallpaper I'm drawing 3 textured quads that covers the whole screen. On Nexus One I get 40fps. I'm looking for ways to improving performance. The quads are blended on top of each other, textures are loaded from RGB_8888 bitmaps. Textures are 1024x1024. I've got glDisable(GL_DITHER); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST); glDisable(GL10.GL_LIGHTING); glDisable(GL_DEPTH_TEST); glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); Things I've tried, all resulting in the same 40fps: Reduce texture size to 512x512 and 256x256 Use draw

Compiling OpenGL SOIL on Mac OS X

依然范特西╮ 提交于 2019-12-03 13:02:13
How would I link in or compile SOIL ( http://lonesock.net/soil.html ) into my C++ OpenGL project on Mac OS X? On newer versions of Mac OS X, such as Leopard, you'll have to edit the make file and add '-arch 1386 -arch x86_64' to the CXX macro of the Makefile. After compiling, you'll also have to link in the CoreFoundation.framework in your project. So your final build command might look something like gcc -Wall -lSOIL -framework OpenGL -framework GLUT -framework CoreFoundation There's a makefile in the zip that you could try using (projects/makefile). You'll want to rename makefile to __M_

Android Opengl-es loading a non-power of 2 texture

放肆的年华 提交于 2019-12-03 12:47:34
I have an app that I've been repeatedly playing with in android, it uses opengl-es. Currently I load textures from a bitmap like so: //Load up and flip the texture - then dispose the temp Bitmap temp = BitmapFactory.decodeResource(Deflecticon.getContext().getResources(), resourceID); Bitmap bmp = Bitmap.createBitmap(temp, 0, 0, temp.getWidth(), temp.getHeight(), flip, true); temp.recycle(); //Bind the texture in memory gl.glBindTexture(GL10.GL_TEXTURE_2D, id); //Set the parameters of the texture. gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR); gl

sf::Texture applied in a wrong way

ぃ、小莉子 提交于 2019-12-03 11:50:50
In my 2D isometric engine, I have the following classes : `maps(variable)/layers(variable)/cubes(variable)/sides(6)/points(4)/coordinates(3)` Each sides contains 4 points (1 point = 1 coordinate (x, y, z)). Each cubes contains 6 sides. I can create a map with the size i want with cubes(same, the size i want). Folers: assets/numTexture/numLight.png I calcule with numTexture and numLight a number wich is the textureNumberEntry(i loaded all numLight.png(textures) in an array). But texturing gones wrong: I define my cubes coordinates in the layer class : for(int J = 0; J < mapSize; J++) { for(int

Three js - Cloning a shader and changing uniform values

ⅰ亾dé卋堺 提交于 2019-12-03 11:33:45
I'm working on creating a shader to generate terrain with shadows. My starting point is to clone the lambert shader and use a ShaderMaterial to eventually customise it with my own script. The standard method works well: var material = new MeshLambertMaterial({map:THREE.ImageUtils.loadTexture('images/texture.jpg')}); var mesh = new THREE.Mesh(geometry, material); etc The result: However I'd like to use the lambert material as a base and work on top of it, so I tried this: var lambertShader = THREE.ShaderLib['lambert']; var uniforms = THREE.UniformsUtils.clone(lambertShader.uniforms); var

Does it make sense to use own mipmap creation algorithm for OpenGL textures?

非 Y 不嫁゛ 提交于 2019-12-03 11:29:54
问题 I was wondering if the quality of texture mipmaps would be better if I used my own algorithm for pre-generating them, instead of the built-in automatic one. I'd probably use a slow but pretty algorithm, like Lanczos resampling. Does it make sense? Will I get any quality gain on modern graphics cards? 回答1: There are good reasons to generate your own mipmaps. However, the quality of the downsampling is not one of them. Game and graphic programmers have experimented with all kinds of

SurfaceTexture updateTexImage to shared 2 EGLContexts - Problems on Android 4.4

我与影子孤独终老i 提交于 2019-12-03 11:21:22
问题 I am referring to this excellent example of how to encode the preview frames of the camera directly into an mp4 file: http://bigflake.com/mediacodec/CameraToMpegTest.java.txt I have adopted the code in the way that I also would like to render the preview image on the screen. Therefore I got something like a GLTextureView with its own EGLContext. This Context is then used as shared EGLContext when I create the EGLContext for the encoder rendering: mEGLContext = EGL14.eglCreateContext

How to use GL_REPEAT to repeat only a selection of a texture atlas? (OpenGL)

梦想与她 提交于 2019-12-03 10:00:29
How can I repeat a selection of a texture atlas? For example, my sprite (selection) is within the texture coordinates: GLfloat textureCoords[]= { .1f, .1f, .3f, .1f, .1f, .3f, .3f, .3f }; Then I want to repeat that sprite N times to a triangle strip (or quad) defined by: GLfloat vertices[]= { -100.f, -100.f, 100.f, -100.f, -100.f, 100.f, 100.f, 100.f }; I know it has something to do with GL_REPEAT and textureCoords going passed the range [0,1] . This however, doesn't work: (trying to repeat N = 10) GLfloat textureCoords[]= { 10.1f, 10.1f, 10.3f, 10.1f, 10.1f, 10.3f, 10.3f, 10.3f }; We're