texture2d

Cut holes in a Texture2D

南笙酒味 提交于 2019-12-12 22:28:34
问题 I want to know how to remove part of a Texture from a Texture2D. I have a simple game in which I want to blow up a planet piece by piece, when a bullet hits it "digs" into the planet. The physics are already working but I am stuck on how to cut the texture properly. I need to create a function that takes a Texture2D a position and a radius as input and returns the new Texture2D. Here is an example of the Texture2D before and after what I want to accomplish. http://img513.imageshack.us/img513

Combine Array of Sprite objects into One Sprite - Unity

筅森魡賤 提交于 2019-12-12 08:22:54
问题 I have an array of Sprite objects in Unity. Their size vary depending on the image loaded. I want to combine them side by side like a tiled map into one image. I want them to be layout like your are forming a line of images, one after the other. (note: NOT one on top of the other) How may I be able to do this? The reason why I'm combining (just for those who want to know) is because I'm using a polygon2D Collider. Since there are some weird behaviors happening when I use multiple colliders

map world coordinate to a texture's value in fragment shader

ε祈祈猫儿з 提交于 2019-12-12 05:28:22
问题 I am trying to map a world coordinate to a texture's value in the fragment shader using threeJS. The generated 'color' is only black but webgl doesn't return any error. Here is what I get: in the 3D, what I get in webgl (black slice instead of an image) in the 2D canvas, what I should in webgl. My shaders: <script id="vertShader" type="shader"> varying vec4 vPos; void main() { vPos = modelViewMatrix * vec4(position, 1.0 ); gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0

Java OpenGL screen sized texture mapped quad

╄→гoц情女王★ 提交于 2019-12-12 04:32:14
问题 I have a Java OpenGL (JOGL) app, and I'm trying to create a texture mapped quad that covers the entire screen. In draw some pixels to a buffer and then I want to read those pixels into a texture and redraw them on screen (with a fragment shader applied). My code for mapping the texture to the viewport is: gl.glMatrixMode(GL.GL_PROJECTION); gl.glPushMatrix(); gl.glLoadIdentity(); gl.glOrtho( 0, width, height, 0, -1, 1 ); gl.glMatrixMode(GL.GL_MODELVIEW); gl.glPushMatrix(); gl.glLoadIdentity();

XNA.Texture2D to System.Drawing.Bitmap

僤鯓⒐⒋嵵緔 提交于 2019-12-12 03:48:35
问题 I need load XNA.Texture2D to PictureBox. i've tried this: http://www.gamedev.net/community/forums/viewreply.asp?ID=3224621 but it doesn't work. Any suggestions? 回答1: You should be able to use that method, but make sure that your XNA Texture2D is created with a format of 32bbpARGB. Any other format will prevent that method from working directly. 回答2: Easier way to do it is save the Texture2D using Texture2D.SaveAsPng or Texture2D.SaveAsJpeg to a memory stream and the open the virtual file

drawing part of open gl texture

杀马特。学长 韩版系。学妹 提交于 2019-12-12 01:26:09
问题 I am trying to draw only part of my sprite sheet. But it just scales the image and no drawing 1/3 of the width of the image. How can I crop the image so only 1/3 shows. Text is below ( ios 7,opengl es 2)- (GLKMatrix4) modelMatrix { GLKMatrix4 modelMatrix = GLKMatrix4Identity; modelMatrix = GLKMatrix4Translate(modelMatrix, x, y, 0); return modelMatrix; } - (void)setSprite:(NSString *)fileName effect:(GLKBaseEffect *)newEffect { // 1 self.effect = newEffect; // 2 NSDictionary * options =

Transferring Texture Across Classes

旧巷老猫 提交于 2019-12-11 20:22:31
问题 (Resizing and LoadContent() ) I want to separate textures by having my Title Screen be in a class and call on it when needed. This would help with neatness but I have only been working with moving sprites across classes and Texture2D is not the same. I have an image 1024X768 and am calling on the image in Title Screen.cs and want to be able to use LoadContent() in Title Screen.cs to load anything with out having to go to Game1.cs to Load the image and come back to Title Screen.cs . Using load

Convert SlimDX.Direct3D11 Texture2D to .Net Bitmap

走远了吗. 提交于 2019-12-11 13:19:59
问题 Converting an .Net Bitmap to a SlimDx Texture2D works very fast like this: http://www.rolandk.de/index.php?option=com_content&view=article&id=65:bitmap-from-texture-d3d11&catid=16:blog&Itemid=10 private Texture2D TextureFromBitmap(FastBitmapSingle fastBitmap) { Texture2D result = null; DataStream dataStream = new DataStream(fastBitmap.BitmapData.Scan0, fastBitmap.BitmapData.Stride * fastBitmap.BitmapData.Height, true, false); DataRectangle dataRectangle = new DataRectangle(fastBitmap

LoadRawTextureData() not enough data provided error in Unity

允我心安 提交于 2019-12-11 11:24:18
问题 I am working on a project using ARcore. I need a real world screen that is visible on the ARcore camera, formerly using the method of erasing UI and capturing. But it was so slow that I found Frame.CameraImage.Texture in Arcore API It worked normally in a Unity Editor environment. But if you build it on your phone and check it out, Texture is null. Texture2D snap = (Texture2D)Frame.CameraImage.Texture; What is the reason? maybe CPU problem? and I tried to do a different function. public class

Conflict drawing on OpenGLES on iOS

三世轮回 提交于 2019-12-11 07:54:05
问题 I'm writing an app allows drawing free style (using finger) and drawing image. I posted one of my problems at OpenGL ES glFragColor depend on if condition on Fragment shader in iOS. Thanks for many suggestions, I solved that. Now I still have another new issue. I have 2 programs which have id PROGRAM_POINT (drawing free style) and PROGRAM_POINT_0 (draw image). Those are initialized. Each program has a pair of shader files. PROGRAM_POINT has shader files named point.vsh and point.fsh. For