Skip to main content
GameDev.net gamedev.net
🔒 Locked

CreateRenderTarget problem

Started by MB Jun 24, 2004 at 1:30 PM 5 replies 3.2k views
Original Post
MB
MB
I am thinking about an ndirect way of creating surfaces, that means: I want to create a IDirect3DSurface8 instead of using a DrawPimitive command. This indirect way of rendering seems to be done with the SetRenderTarget command. Nevertheless, creating a surface with CreateRenderTarget poses strange problems, since the compiler does not accept the forth parameter (which demands D3DMULTISAMPLE_TYPE MultiSample, which is a simple enumeration type). I did a little internet reserarch and found that I am not all alone with this troubleshooting, but no solution. Any idea? Oder is there a better way of indirectly creating surfaces (or textures)?
http://www.superfluxus.de/phpBB2
Mezz
Mezz
What is the line of code exactly, and what error are you getting?
If it's a compiler one, paste it in here.
If it's a runtime one, increase the D3D debug output in the control panel and see what the debugger says.

I don't quite understand the question you're asking about indirectly creating surfaces, could you phrase it again?

Thanks,

-Mezz
MB
MB
stopped the computer, I am programming on, so the compiler error is quoted from memory. It says that it does not accept parameter 4, noting a type problem (int is not multisampling enumeration type).

The background of my question is the following:

I would like to do multitexturing, but not in a dynamic way, but with surfaces that may contain a certain layered picture for a while.

RenderToTarget allows adressing a surface, so it would be a suitable candidate for that operation.

Being quite unexperienced in this puzzling field of renderstates etc. this might be erroneous, but the sources I rely on directed me in that direction.

http://www.superfluxus.de/phpBB2
darookie
darookie
If I didn't get you wrong, you want to use a single pre-blended
set of texture layers as one single texture for your geometry.
If this is the case, don't render them to a surface and use that
as texture.
Simply pre-process the affected textures offline and load them
on-demand (or keep them in memory).

In some cases, however, this approach won't work - for example
detail textures for terrain. If your problem is lack of texture
units on the gfx card (e.g. 4 layers and only two texture units)
, render multiple passes.

The DX SDK contais a nice tool that visualises the effects of
different renderstates with multi-texturing. It also produces
ready-to-use code snippets that you can just copy 'n paste to your
code. The tool is called "MFCTex" and is located at %DXSDK_ROOT%/C++/samples/direct3d/bin

Hope that helps,
Pat
MB
MB
thanks Pat, thanks Mezz,

his is very helpful, although I am still wondering about the Set/CreateRenderTarget function. It seems that the DirectX developers have designed it for the sole purpose of creating an interface to feeback some texture to anothers texture (textura a -> transformation -> texture b).
Creating offline is surely an option, but not first choice. I would like to use a surface like a variable which is changed for time to time, but is not part of a recursive function.
Am I wrong assuming that SetRendTarget is the way to do this?
http://www.superfluxus.de/phpBB2
darookie
darookie
Quote:
Original post by MB
It seems that the DirectX developers have designed it for the sole purpose of creating an interface to feeback some texture to anothers texture (textura a -> transformation -> texture b).

Actually, the main use is creating textures from scene geometry,
e.g. shadow buffers, cube textures for environment maps, reflections
and so on.
When rendering to an off-screen surface, the geometry pipeline
is still used. So using it for the sole purpose of blending a
bunch of textures might introduce a noticeable overhead if you
do it each frame or even multiple times per frame. That's what
multi-texturing is supposed to do.

Quote:

I would like to use a surface like a variable which is changed for time to time, but is not part of a recursive function.
Am I wrong assuming that SetRendTarget is the way to do this?

It depends on the number of textures involved and on the update
frequency. It might be a good idea to have a set of dynamic
textures for that purpose. The textures are blended manually
(e.g. you don't have to mess with renderstates) and manipulated
if required. The "scratch" memory pool is great for such things.

Good luck,
Pat
MB
MB
thanks Pat,

yes, I thought about efficiency and memory allocations problems - but hat the idea that a few nested buffers would be better and faster than loading textures form harddisk - and secondly that they might be prone to some interesting manipulations.

I started using the nice CxImage class from Davide Pizzolato which does a few things which could be very useful (like using various laylers, writing on the surface), so that's the background.

The sole thing I found concerning blending of trextures was this

http://www.thehavok.co.uk/scene/32bits/tutorials/directx/techniques/source/rendertotexture.cpp.html

but this seems a little complicated (creatng a virtual object to bled two surfaces)

Isn't there any simpler and faster way?

http://www.superfluxus.de/phpBB2

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.