Jump to content
  • Advertisement
Sign in to follow this  
2dcoder

VB6 - Render To Texture (Should be easy right?)

This topic is 4619 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Public SceneRenderTargetBuffer As Direct3DSurface8 Public SceneRenderToSurface As Direct3DSurface8 ' Sub RenderToStart(Texture As Direct3DTexture8) ' Set SceneRenderTargetBuffer = D3DDevice.GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO) Set SceneRenderToSurface = Texture.GetSurfaceLevel(0) D3DDevice.EndScene D3DDevice.SetRenderTarget SceneRenderToSurface, Nothing, 0 D3DDevice.BeginScene D3DDevice.Clear 0, ByVal 0, D3DCLEAR_TARGET, DX.Lib.GetARGBColor(255, 0, 0, 0), 1#, 0 ' End Sub ' Sub RenderToEnd() ' D3DDevice.EndScene D3DDevice.SetRenderTarget SceneRenderTargetBuffer, Nothing, 0 D3DDevice.BeginScene DoLog "Done" ' This line gets written!! ' End Sub So in your code: ' D3DDevice.BeginScene ' ' Render stuff normally to backbuffer ' etc,etc,etc ' ' Now render a few things to a texture ' RenderToStart MyTexture ' etc,etc,etc ' RenderToEnd ' ' Go on with scene ' etc,etc,etc ' D3DDevice.EndScene So what's the problem? Well, it works great in the IDE, but fails on all computers when compiled. Actually it never makes it out of the RenderToEnd() routine even though if I add a log line at the end the log gets written. I get the weird "Automation 440" Error. Very strange!! If I remark this line in the RenderToEnd() routine: D3DDevice.SetRenderTarget SceneRenderTargetBuffer, Nothing, 0 Then it at least makes it out of the routine, so setting the render target back to the original seems to be causing the automation error. The passed texture has it's usage flag set to render target and is placed in the default pool. The other non render target textures are placed in the managed pool. !@#$% Am I doing something wrong? Is there a different way to do this? Based on my research I don't think so?!?! The code compared to other parts of my dx code seems trivial and very basic, so why is this giving me problems? !@#$%^& Thanks for your time.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!