protected unsafe void setupVideoGraphicsObject() { this.mCubeTexture = TextureManager.Singleton.CreateManual( "MyCubeTexture", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME, TextureType.TEX_TYPE_2D, (uint)this.TexWidth, (uint)this.TexHeight, 0, Mogre.PixelFormat.PF_A8R8G8B8); MaterialPtr inMat = MaterialManager.Singleton.Create("MyCubeMat", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME); inMat.GetTechnique(0).GetPass(0).CreateTextureUnitState("MyCubeTexture"); mCubeEntity.SetMaterialName("MyCubeMat"); // draw bitmap to texture HardwarePixelBufferSharedPtr texBuffer = this.mCubeTexture.GetBuffer(); texBuffer.Lock(HardwareBuffer.LockOptions.HBL_DISCARD); PixelBox pb = texBuffer.CurrentLock; using (Bitmap bm = new Bitmap( (int)this.mCubeTexture.Width, (int)this.mCubeTexture.Height, (int)((this.mCubeTexture.Width * 4) + (pb.RowSkip * 4)), System.Drawing.Imaging.PixelFormat.Format32bppArgb, pb.data)) { mVideoGraphics = Graphics.FromImage(bm); } texBuffer.Unlock(); texBuffer.Dispose(); }
public override void RemoveTexture(string name) { if (TextureManager.Singleton.ResourceExists(name) == false) { return; } Texture texturePtr = TextureManager.Singleton.GetByName(name); // handle render textures if (texturePtr.Usage == (int)TextureUsage.TU_RENDERTARGET) { using (HardwarePixelBufferSharedPtr buf = texturePtr.GetBuffer()) { using (RenderTexture renderTexture = buf.GetRenderTarget()) { renderTexture.RemoveAllViewports(); } } } // When we dispose we release and unload/remove Texture texturePtr.Dispose(); //TextureManager.Singleton.Remove(name); }
public VideoTexture(SceneManager scm, float width, float height, string aviFileName) { AviManager aviMgr = new AviManager(aviFileName, true); Stream = aviMgr.GetVideoStream(); TexturePtr VideoTexture = TextureManager.Singleton.CreateManual( "Video", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME, TextureType.TEX_TYPE_2D, Convert.ToUInt32(Stream.Width), Convert.ToUInt32(Stream.Height), 0, PixelFormat.PF_R8G8B8A8, (int)TextureUsage.TU_DYNAMIC_WRITE_ONLY_DISCARDABLE); MaterialPtr VideoMat = MaterialManager.Singleton.Create( "VideoMat", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME); VideoMat.GetTechnique(0).GetPass(0).LightingEnabled = false; VideoMat.GetTechnique(0).GetPass(0).CreateTextureUnitState("Video"); PixelBuffer = VideoTexture.GetBuffer(); screen = scm.CreateManualObject("Screen"); screen.Dynamic = true; screen.Begin("VideoMat", RenderOperation.OperationTypes.OT_TRIANGLE_LIST); screen.Position(0, 0, 0); screen.TextureCoord(0, 0); screen.Position(width, 0, 0); screen.TextureCoord(1, 0); screen.Position(width, height, 0); screen.TextureCoord(1, 1); screen.Triangle(0, 1, 2); screen.Position(0, 0, 0); screen.TextureCoord(0, 0); screen.Position(width, height, 0); screen.TextureCoord(1, 1); screen.Position(0, height, 0); screen.TextureCoord(0, 1); screen.Triangle(3, 4, 5); screen.End(); SceneNode node = scm.RootSceneNode.CreateChildSceneNode(); node.Position = new Vector3(0, 0, 0); node.AttachObject(screen); Stream.GetFrameOpen(); FrameNum = 0; }
private unsafe void ConvertBitmap(Bitmap pTextureBitmap) { if (this.mCubeTexture == null) { this.mCubeTexture = TextureManager.Singleton.CreateManual( "MyCubeTexture", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME, TextureType.TEX_TYPE_2D, (uint)this.TexWidth, (uint)this.TexHeight, 0, Mogre.PixelFormat.PF_A8R8G8B8); MaterialPtr inMat = MaterialManager.Singleton.Create("MyCubeMat", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME); inMat.GetTechnique(0).GetPass(0).CreateTextureUnitState("MyCubeTexture"); mCubeEntity.SetMaterialName("MyCubeMat"); } if (pTextureBitmap != null) { // draw bitmap to texture HardwarePixelBufferSharedPtr texBuffer = this.mCubeTexture.GetBuffer(); texBuffer.Lock(HardwareBuffer.LockOptions.HBL_DISCARD); PixelBox pb = texBuffer.CurrentLock; using (Bitmap bm = new Bitmap( (int)this.mCubeTexture.Width, (int)this.mCubeTexture.Height, (int)((this.mCubeTexture.Width * 4) + (pb.RowSkip * 4)), System.Drawing.Imaging.PixelFormat.Format32bppArgb, pb.data)) { using (Graphics g = Graphics.FromImage(bm)) { //g.DrawImage(this.mTextureBitmap, 0, 0); g.DrawImage(pTextureBitmap, new System.Drawing.Rectangle(0, 0, (int)this.mCubeTexture.Width, (int)this.mCubeTexture.Height)); } } texBuffer.Unlock(); texBuffer.Dispose(); } /* * // draw bitmap to texture * HardwarePixelBufferSharedPtr texBuffer = this.mCubeTexture.GetBuffer(); * texBuffer.Lock(HardwareBuffer.LockOptions.HBL_DISCARD); * mVideoGraphics.DrawImage(this.mTextureBitmap, new System.Drawing.Rectangle(0, 0, (int)this.mCubeTexture.Width, (int)this.mCubeTexture.Height)); * texBuffer.Unlock(); */ }
public void Dispose() { Stream.GetFrameClose(); PixelBuffer.Dispose(); screen.Dispose(); videoMat.Dispose(); videoTex.Dispose(); videoTex = null; videoMat = null; screen = null; PixelBuffer = null; FrameNum = 0; }
public FeedbackBuffer(VirtualTextureManager virtualTextureManager, IntSize2 renderSize, int id, uint visibilityMask) { this.id = id; this.virtualTextureManager = virtualTextureManager; this.visibilityMask = visibilityMask; texture = TextureManager.getInstance().createManual(TextureName, VirtualTextureManager.ResourceGroup, TextureType.TEX_TYPE_2D, (uint)renderSize.Width, (uint)renderSize.Height, 1, 0, OgrePlugin.PixelFormat.PF_A8R8G8B8, TextureUsage.TU_RENDERTARGET, null, false, 0); fullBitmap = new FreeImageBitmap((int)texture.Value.Width, (int)texture.Value.Height, FreeImageAPI.PixelFormat.Format32bppRgb); fullBitmapBox = fullBitmap.createPixelBox(OgrePlugin.PixelFormat.PF_A8R8G8B8); pixelBuffer = texture.Value.getBuffer(); pixelBuffer.Value.OptimizeReadback = true; renderTexture = pixelBuffer.Value.getRenderTarget(); renderTexture.setAutoUpdated(false); }
public override unsafe void WriteToTexture(byte[] bytes, object textureHandle) { // draw bitmap to texture Texture texture = SafeResolveTexture(textureHandle); using (HardwarePixelBufferSharedPtr texBuffer = texture.GetBuffer()) { texBuffer.Lock(HardwareBuffer.LockOptions.HBL_DISCARD); PixelBox pb = texBuffer.CurrentLock; Debug.Assert(texture.Width == texture.SrcWidth && texture.Height == texture.SrcHeight, "Texture dimensions altered by render system."); Marshal.Copy(bytes, 0, pb.data, bytes.Length); texBuffer.Unlock(); } }
public unsafe void Replace2(byte[] bytes, string textureName) { if (this.IndexOf(textureName) < 0) { throw new ArgumentException("The texture \"" + textureName + "\"doesn't exist"); } TexturePtr pTexture = this[textureName]; HardwarePixelBufferSharedPtr texBuffer = pTexture.GetBuffer(); texBuffer.Lock(HardwareBuffer.LockOptions.HBL_DISCARD); PixelBox pb = texBuffer.CurrentLock; Marshal.Copy(bytes, 0, pb.data, bytes.Length); texBuffer.Unlock(); texBuffer.Dispose(); }
public TextureSceneView(SceneViewController controller, CameraMover cameraMover, String name, BackgroundScene background, int zIndexStart, int width, int height) : base(controller, cameraMover, name, background, zIndexStart) { resourceLoader = new ManualResourceLoader(this); this.TextureName = name; texture = TextureManager.getInstance().createManual(name, MyGUIInterface.Instance.CommonResourceGroup.FullName, TextureType.TEX_TYPE_2D, (uint)width, (uint)height, 1, 0, ogreTextureFormat, TextureUsage.TU_RENDERTARGET, resourceLoader, false, 0); pixelBuffer = texture.Value.getBuffer(); renderTexture = pixelBuffer.Value.getRenderTarget(); this.RenderingEnded += TextureSceneView_RenderingEnded; rendererWindow = new ManualWindow(renderTexture); this.RendererWindow = rendererWindow; this.ClearEveryFrame = true; this.BackColor = new Engine.Color(0, 0, 0, 0); }
public unsafe void Replace3(byte[] bytes, string textureName) { using (ResourcePtr rpt = TextureManager.Singleton.GetByName(textureName)) { using (TexturePtr texture = rpt) { HardwarePixelBufferSharedPtr texBuffer = texture.GetBuffer(); texBuffer.Lock(HardwareBuffer.LockOptions.HBL_DISCARD); PixelBox pb = texBuffer.CurrentLock; Marshal.Copy(bytes, 0, pb.data, bytes.Length); texBuffer.Unlock(); texBuffer.Dispose(); } } }
private void createColorTexture() { if (colorTexture == null) { sensorManager.SensorColorFrameReady += sensorManager_SensorColorFrameReady; //This is an ok example of how to do video textuers, but its really only good enough for development right now //We are having to create the texture as a rendertarget when we should probably use a dynamic texture instead, however, //the D3D11 plugin will crash if we use any other kind of texture, so for now we are just using this. //If putting the texture in mygui it is important to tell its render manager to destroy the texture also (like the RocketWidget does). PixelFormat pixelFormat = PixelFormat.PF_R8G8B8A8; IntSize2 colorFrameSize = sensorManager.ColorFrameSize; colorTexture = TextureManager.getInstance().createManual("KinectColorSensor", MyGUIInterface.Instance.CommonResourceGroup.FullName, TextureType.TEX_TYPE_2D, (uint)colorFrameSize.Width, (uint)colorFrameSize.Height, 1, 0, pixelFormat, TextureUsage.TU_RENDERTARGET, null, false, 0); hwBuffer = colorTexture.Value.getBuffer(); pixelBox = new PixelBox(0, 0, colorFrameSize.Width, colorFrameSize.Height, pixelFormat); colorSensorImage.setItemResource(null); //Clear the "ItemResource" first since we are setting texture directly colorSensorImage.setCoord(colorSensorImageOriginalPos.left, colorSensorImageOriginalPos.top, colorSensorImageOriginalPos.width, colorSensorImageOriginalPos.height); colorSensorImage.setImageTexture(colorTexture.Value.getName()); colorSensorImage.setImageCoord(new IntCoord(0, 0, colorFrameSize.Width, colorFrameSize.Height)); } }
private static unsafe void ConvertImageToTexture(Bitmap image, string textureName, Size size) { int width = size.Width; int height = size.Height; using (ResourcePtr rpt = TextureManager.Singleton.GetByName(textureName)) { using (TexturePtr texture = rpt) { HardwarePixelBufferSharedPtr texBuffer = texture.GetBuffer(); texBuffer.Lock(HardwareBuffer.LockOptions.HBL_DISCARD); PixelBox pb = texBuffer.CurrentLock; System.Drawing.Imaging.BitmapData data = image.LockBits(new System.Drawing.Rectangle(0, 0, width, height), System.Drawing.Imaging.ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); CopyMemory(pb.data, data.Scan0, (uint)(width * height * 4)); image.UnlockBits(data); texBuffer.Unlock(); texBuffer.Dispose(); } } }
internal static unsafe void ClearTexture(Texture texture, Colour colour) { using (HardwarePixelBufferSharedPtr hbuf = texture.GetBuffer()) { hbuf.Lock(HardwareBuffer.LockOptions.HBL_NORMAL); PixelBox pb = hbuf.CurrentLock; byte *destData = (byte *)pb.data; uint destPixelSize = PixelUtil.GetNumElemBytes(pb.format); uint destRowPitchBytes = pb.rowPitch * destPixelSize; ColourValue cv = new ColourValue(colour.Red / 255f, colour.Green / 255f, colour.Blue / 255f, colour.Alpha / 255f); for (uint i = 0; i < texture.Height; i++) { for (uint j = 0; j < texture.Width; j++) { uint offset = (i * destRowPitchBytes) + (j * destPixelSize); PixelUtil.PackColour(cv, pb.format, &destData[offset]); } } hbuf.Unlock(); } }
public void resized() { //Only resize if enabled. if (renderingEnabled) { //Compute texture size int textureWidth = computeSize(imageBox.Width); int textureHeight = computeSize(imageBox.Height); if (textureWidth != currentTextureWidth || textureHeight != currentTextureHeight) { currentTextureWidth = textureWidth; currentTextureHeight = textureHeight; //Destroy old render target if (renderTexture != null) { renderTexture.destroyViewport(vp); pixelBuffer.Dispose(); texture.Dispose(); RenderManager.Instance.destroyTexture(textureName); } generateTextureName(); texture = TextureManager.getInstance().createManual(textureName, RocketInterface.Instance.CommonResourceGroup.FullName, TextureType.TEX_TYPE_2D, (uint)textureWidth, (uint)textureHeight, 1, 0, ogreTextureFormat, TextureUsage.TU_RENDERTARGET, this, false, 0); pixelBuffer = texture.Value.getBuffer(); renderTexture = pixelBuffer.Value.getRenderTarget(); vp = renderTexture.addViewport(camera); vp.setBackgroundColor(ClearColor); vp.setOverlaysEnabled(false); vp.clear(); renderQueueListener.RenderDimensions = new IntSize2(textureWidth, textureHeight); renderQueueListener.RequiresTextureFlipping = renderTexture.requiresTextureFlipping(); } int imageWidth = imageBox.Width; if (imageWidth < 0) { imageWidth = 0; } int imageHeight = imageBox.Height; if (imageHeight < 0) { imageHeight = 0; } context.Dimensions = new Vector2i(imageWidth, imageHeight); if (afterFirstImageBoxTextureAssignment) { imageBox.setImageInfo(textureName, new IntCoord(0, 0, imageWidth, imageHeight), new IntSize2(imageWidth, imageHeight)); } else { imageBox.setImageTexture(textureName); imageBox.setImageCoord(new IntCoord(0, 0, imageBox.Width, imageBox.Height)); afterFirstImageBoxTextureAssignment = true; } renderOneFrame = true; determineRenderingActive(); } }
private IEnumerable <IdleStatus> createRender(int finalWidth, int finalHeight, int aaMode, bool showWatermark, bool transparentBG, Engine.Color backColor, Camera cloneCamera, Vector3 position, Vector3 lookAt, float minNearDistance, float nearPlaneWorld, float nearFarLength, ImageRendererProperties properties, Action <FreeImageBitmap> renderingCompletedCallback) { FreeImageBitmap bitmap = null; OgreSceneManager sceneManager = controller.CurrentScene.getDefaultSubScene().getSimElementManager <OgreSceneManager>(); if (sceneManager != null) { bool doGridRender; int backBufferWidth; int backBufferHeight; using (TexturePtr texture = createOgreTexture(finalWidth, finalHeight, aaMode, out doGridRender, out backBufferWidth, out backBufferHeight)) { if (texture != null) { using (HardwarePixelBufferSharedPtr pixelBuffer = texture.Value.getBuffer()) { RenderTexture renderTexture = pixelBuffer.Value.getRenderTarget(); Camera camera = sceneManager.SceneManager.createCamera("__PictureCamera"); camera.setLodBias(cloneCamera.getLodBias()); camera.setUseRenderingDistance(cloneCamera.getUseRenderingDistance()); camera.setNearClipDistance(cloneCamera.getNearClipDistance()); camera.setFarClipDistance(cloneCamera.getFarClipDistance()); camera.setPolygonMode(cloneCamera.getPolygonMode()); camera.setRenderingDistance(cloneCamera.getRenderingDistance()); camera.setProjectionType(cloneCamera.getProjectionType()); camera.setFOVy(cloneCamera.getFOVy()); camera.setAutoAspectRatio(false); camera.setAspectRatio((float)finalWidth / finalHeight); SceneNode node = sceneManager.SceneManager.createSceneNode("__PictureCameraNode"); node.attachObject(camera); node.setPosition(position); sceneManager.SceneManager.getRootSceneNode().addChild(node); camera.lookAt(lookAt); Viewport viewport = renderTexture.addViewport(camera, 1, 0.0f, 0.0f, 1.0f, 1.0f); if (properties.UseIncludePoint) { Matrix4x4 viewMatrix = camera.getViewMatrix(); Matrix4x4 projectionMatrix = camera.getProjectionMatrix(); float aspect = camera.getAspectRatio(); float fovy = camera.getFOVy() * 0.5f; float distance = SceneViewWindow.computeOffsetToIncludePoint(viewMatrix, projectionMatrix, properties.IncludePoint, aspect, fovy); Vector3 direction = (position - lookAt).normalized(); node.setPosition(position - (direction * distance)); camera.lookAt(lookAt); } if (transparentBG) { backColor.a = 0.0f; } ViewportBackground bgViewport = null; if (background != null) { bgViewport = new ViewportBackground("ImageRenderer", 0, background, renderTexture, false); bgViewport.BackgroundColor = backColor; bgViewport.Camera.setAutoAspectRatio(false); bgViewport.Camera.setAspectRatio((float)finalWidth / finalHeight); } viewport.setBackgroundColor(backColor); viewport.setOverlaysEnabled(false); viewport.setClearEveryFrame(false); if (properties.CustomizeCameraPosition != null) { properties.CustomizeCameraPosition(camera, viewport); } float near = CameraPositioner.computeNearClipDistance(camera.getDerivedPosition().length(), minNearDistance, nearPlaneWorld); camera.setNearClipDistance(near); camera.setFarClipDistance(near + nearFarLength); if (doGridRender) { IEnumerable <IdleStatus> process = gridRender(finalWidth * aaMode, finalHeight * aaMode, backBufferWidth, backBufferHeight, aaMode, renderTexture, camera, bgViewport != null ? bgViewport.Camera : null, transparentBG, backColor, (product) => { bitmap = product; }); foreach (IdleStatus idleStatus in process) { yield return(idleStatus); } } else { bitmap = simpleRender(backBufferWidth, backBufferHeight, aaMode, transparentBG, backColor, renderTexture); } if (showWatermark && LoadLogo != null) { using (FreeImageBitmap logo = LoadLogo()) { float imageFinalHeight = bitmap.Height * 0.0447f; float scale = imageFinalHeight / logo.Height; float imageFinalWidth = logo.Width * scale; if (imageFinalWidth > bitmap.Width) { imageFinalWidth = bitmap.Width; scale = imageFinalWidth / logo.Width; imageFinalHeight = logo.Height * scale; } logo.Rescale((int)imageFinalWidth, (int)imageFinalHeight, FREE_IMAGE_FILTER.FILTER_BILINEAR); //Have to composite the logo image first. using (FreeImageBitmap fullImageCorner = bitmap.Copy(0, bitmap.Height - (int)imageFinalHeight, (int)imageFinalWidth, bitmap.Height)) { fullImageCorner.ConvertColorDepth(FREE_IMAGE_COLOR_DEPTH.FICD_24_BPP); logo.Composite(false, null, fullImageCorner); } bitmap.Paste(logo, 0, bitmap.Height - (int)imageFinalHeight, int.MaxValue); } } renderTexture.destroyViewport(viewport); if (bgViewport != null) { bgViewport.Dispose(); } sceneManager.SceneManager.getRootSceneNode().removeChild(node); sceneManager.SceneManager.destroySceneNode(node); sceneManager.SceneManager.destroyCamera(camera); TextureManager.getInstance().remove(texture); } } else { //An error making the render texture. Log it and return the error image. Log.Error("Could not render image. Returning placeholder image. Reason: Could not create valid render to texture target."); bitmap = new FreeImageBitmap(finalWidth, finalHeight); bitmap.FillBackground(new RGBQUAD() { rgbRed = 255 }); } } } renderingCompletedCallback(bitmap); yield break; }
protected virtual void LoadImages(List <Image> images) { Debug.Assert(images.Count >= 1); if (isLoaded) { log.InfoFormat("Unloading image: {0}", name); Unload(); } srcWidth = width = images[0].Width; srcHeight = height = images[0].Height; srcDepth = depth = images[0].Depth; if (hasAlpha && images[0].Format == PixelFormat.L8) { format = PixelFormat.A8; srcBpp = 8; } else { this.Format = images[0].Format; } if (finalBpp == 16) { switch (format) { case PixelFormat.R8G8B8: case PixelFormat.X8R8G8B8: format = PixelFormat.R5G6B5; break; case PixelFormat.B8G8R8: case PixelFormat.X8B8G8R8: format = PixelFormat.B5G6R5; break; case PixelFormat.A8R8G8B8: case PixelFormat.R8G8B8A8: case PixelFormat.A8B8G8R8: case PixelFormat.B8G8R8A8: format = PixelFormat.A4R4G4B4; break; default: // use the original format break; } } // The custom mipmaps in the image have priority over everything int imageMips = images[0].NumMipMaps; if (imageMips > 0) { numMipmaps = imageMips; usage &= ~TextureUsage.AutoMipMap; } // Create the texture CreateInternalResources(); // Check if we're loading one image with multiple faces // or a vector of images representing the faces int faces; bool multiImage; // Load from multiple images? if (images.Count > 1) { faces = images.Count; multiImage = true; } else { faces = images[0].NumFaces; multiImage = false; } // Check wether number of faces in images exceeds number of faces // in this texture. If so, clamp it. if (faces > this.NumFaces) { faces = this.NumFaces; } // Say what we're doing log.InfoFormat("Texture: {0}: Loading {1} faces({2},{3}x{4}x{5})", name, faces, PixelUtil.GetFormatName(images[0].Format), images[0].Width, images[0].Height, images[0].Depth); #if NOT // crazy ogre logging if (!(mMipmapsHardwareGenerated && mNumMipmaps == 0)) { str << mNumMipmaps; } if (mUsage & TU_AUTOMIPMAP) { if (mMipmapsHardwareGenerated) { str << " hardware"; } str << " generated mipmaps"; } else { str << " custom mipmaps"; } if (multiImage) { str << " from multiple Images."; } else { str << " from Image."; } // Scoped { // Print data about first destination surface HardwarePixelBufferSharedPtr buf = getBuffer(0, 0); str << " Internal format is " << PixelUtil::getFormatName(buf->getFormat()) << "," << buf->getWidth() << "x" << buf->getHeight() << "x" << buf->getDepth() << "."; } LogManager::getSingleton().logMessage( LML_NORMAL, str.str()); #endif // Main loading loop // imageMips == 0 if the image has no custom mipmaps, otherwise contains the number of custom mips for (int mip = 0; mip <= imageMips; ++mip) { for (int i = 0; i < faces; ++i) { PixelBox src; if (multiImage) { // Load from multiple images src = images[i].GetPixelBox(0, mip); } else { // Load from faces of images[0] src = images[0].GetPixelBox(i, mip); if (hasAlpha && src.Format == PixelFormat.L8) { src.Format = PixelFormat.A8; } } if (gamma != 1.0f) { // Apply gamma correction // Do not overwrite original image but do gamma correction in temporary buffer IntPtr buffer = Marshal.AllocHGlobal(PixelUtil.GetMemorySize(src.Width, src.Height, src.Depth, src.Format)); try { PixelBox corrected = new PixelBox(src.Width, src.Height, src.Depth, src.Format, buffer); PixelUtil.BulkPixelConversion(src, corrected); Image.ApplyGamma(corrected.Data, gamma, corrected.ConsecutiveSize, PixelUtil.GetNumElemBits(src.Format)); // Destination: entire texture. BlitFromMemory does the scaling to // a power of two for us when needed GetBuffer(i, mip).BlitFromMemory(corrected); } finally { Marshal.FreeHGlobal(buffer); } } else { // Destination: entire texture. BlitFromMemory does the scaling to // a power of two for us when needed GetBuffer(i, mip).BlitFromMemory(src); } } } // Update size (the final size, not including temp space) size = this.NumFaces * PixelUtil.GetMemorySize(width, height, depth, format); isLoaded = true; }
private void createTexture() { physicalTexture = TextureManager.getInstance().createManual(textureName, VirtualTextureManager.ResourceGroup, TextureType.TEX_TYPE_2D, (uint)size.Width, (uint)size.Height, 1, 0, pixelFormat, virtualTextureManager.RendersystemSpecificTextureUsage, null, false, 0); buffer = physicalTexture.Value.getBuffer(); }
public FrontBuffer(TexturePtr texture) { this.texture = texture; pixelBuffer = texture.Value.getBuffer(); }