Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Render To Texture

Author
Message
Red Eye
15
Years of Service
User Offline
Joined: 15th Oct 2008
Location:
Posted: 1st May 2011 14:31 Edited at: 1st May 2011 14:32
Hello,

I have been looking into DirectX, and I am having some nasty problems.

http://www.two-kings.de/tutorials/dxgraphics/dxgraphics16.html

I am trying to follow the tutorial, but I have some problems:

1. Where in the code does the "object" gets rendered to the texture?
2. How can I use only one object id to render to a texture while others are still in the scene?
3. After creating a directx texture, how would I apply that with dbTextureObject(); to an object?

Thanks,

Leo

Red Eye
15
Years of Service
User Offline
Joined: 15th Oct 2008
Location:
Posted: 1st May 2011 17:07
So I understand that this part handles the render to texture.



Now I need to find a way to make this work for our own db Objects..

_Pauli_
AGK Developer
15
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 1st May 2011 17:53 Edited at: 1st May 2011 17:53
The easy way to render to a texture is to have a second camera and set it to an image:



Then you can texture objects with it, etc.

Red Eye
15
Years of Service
User Offline
Joined: 15th Oct 2008
Location:
Posted: 1st May 2011 19:13 Edited at: 1st May 2011 19:15
Okay great thanks!

Some problems:

1. Even though I first create a camera with id 1, and then set the current camera to 0, dgdk starts with camera 1.

//Render Camera Creation


Code:


_Pauli_
AGK Developer
15
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 1st May 2011 22:38
Quote: "dgdk starts with camera 1."


I don't understand, what does it start?

Also I wondered why you're deleting the render image before you texture object with?
You just need to set the camera to the image once, and it will update the image automaticaly when you sync.

Red Eye
15
Years of Service
User Offline
Joined: 15th Oct 2008
Location:
Posted: 1st May 2011 23:01
Hey Pauli!

First of all thanks for your time.

DGDK auto switches to camera 1. So it makes the current camera 1.

About the rendered image you are right... It was a quick fix for something else, I will change that right away.

_Pauli_
AGK Developer
15
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 1st May 2011 23:28
Quote: "DGDK auto switches to camera 1. So it makes the current camera 1."


That happens when you create a new camera. The newly created camera is then automaticaly the current camera.
Calling dbSetCurrentCamera( 0 ) after you create the camera should do it.

Red Eye
15
Years of Service
User Offline
Joined: 15th Oct 2008
Location:
Posted: 1st May 2011 23:29 Edited at: 2nd May 2011 00:40
Thats why it is wierd, calling that doesnt work!

What I want is basicly rendering a object to a texture. No matter what other objects are in the scene it must only render that object to the texture...

Red Eye
15
Years of Service
User Offline
Joined: 15th Oct 2008
Location:
Posted: 4th May 2011 10:32
Any other suggestions?

Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 4th May 2011 19:16
You draw objects to selected cameras like this:


There is also a command dbSyncMask(), I think this allows you to sync() to selected cameras.

_Pauli_
AGK Developer
15
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 4th May 2011 23:37 Edited at: 5th May 2011 01:00
Ok, you could first set your objects to only be visible in one camera using this function (does the same as mattys btw.):



Then you need to set up a little sync chain, to render the two versions of the scene. For this (and the second parameter of the function above) you may find this makro useful. Just pass it the desired camera ID and insert it where a camera DWORD is needed:



Your sync setup could then look something this:



Hope this helps.

Red Eye
15
Years of Service
User Offline
Joined: 15th Oct 2008
Location:
Posted: 5th May 2011 00:16
Wow thanks for the help, and thank you for willing to help, i will put it to work asap.

I will post my results.

Login to post a reply

Server time is: 2024-10-02 17:32:05
Your offset time is: 2024-10-02 17:32:05