Problem cleaning up after using vertex buffer.

Win32 Programming

    Next

  • 1. Font Outline with DirectX
    Can anyone please give a simple example of how to do font outlines with directx. I can't find any examples anywhere. It must be possible/simple - I know you could do it with GDI fillpath and fillstroke. I want to display some text with a black outline and a red fill for example. Only need 2D text. Thanks Andy.
  • 2. D3DXCreateKeyFrameInterpolator
    Hi, Does anyone know if there is any documentation for this function? Microsoft's documentation has no say about this function Searched the web Google, MSN and Yahoo! take me to nowhere. Just found 1 or 2 pages in Japanese from which I can't understand Thanks
  • 3. Sprite Vs Quad Screen Coordinates.
    Hi, I've created a very simple Google-map style 'sheet' (arbitrary background image that can be grabbed and moved around using a hand icon). I've used D3DX to load a texture but then I used the Sprite->Draw() method to render the texture. I'd like to avoid having my BG image (gameboard) as a sprite and keep it as a textured quad (or set of quads) but I'm struggling to render this in screen coordinates. So, how do you draw a texture on the screen using screen coordinates (i.e., what is the equivalent process to render the textured quad in screen coordinates - supplying the x/y coords?). All suggestions / links to code are most welcome. Thank you Chris
  • 4. RegisterAnimationSet problem
    spec1[0].Time = 0.0f; spec1[0].Value = D3DXVECTOR3 (10.0f, 10.0f, 10.0f); spec1[1].Time = 1.0f; spec1[1].Value = D3DXVECTOR3 (20.0f, 20.0f, 20.0f); hr = D3DXCreateKeyFrameInterpolator ("open", NULL, 0, NULL, 0, (LPD3DXKEY_VECTOR3)&spec1, 2, 1.0f, (LPD3DXKEYFRAMEINTERPOLATOR*) &po1); // hr = S_OK; po1->AddRef(); hr = D3DXCreateAnimationSet ("Open2",&po1, 1, &pSet2); // hr = S_OK; pSet2->AddRef(); hr = m_pAnimController->RegisterAnimationSet(pSet2); <<<<<<<<<<<<<<<<<< fails hr = 8876086c hr = m_pAnimController->SetTrackAnimationSet(1, pSet2); hr = m_pAnimController->KeyTrackWeight(1, 0.0f, m_pAnimController->GetTime(), 0.1f, D3DXTRANSITION_LINEAR ); ---------------------------- D3DX: ID3DXAnimationController::RegisterAnimationSet: Number of animation sets registered is equal to the max number set at creation time. Thanks for any hints
  • 5. Directdraw 7 Overlay getting lost
    Hi, This is a question on DX7 overlays. I can't for the life of me work out why my poor little overlay sitting over my window is getting lost when another app goes into full screen mode (even trying the Pinball game) then comes back out to the desktop. I know the overlay sits in video memory, but with enough video RAM on the graphics card, why is the buffer getting lost in the first place and why can't I restore it, even though I catch SURFACELOST and try to restore all my surfaces and bitmaps. When the other app is activated, my windows loses focus, but I still refresh my window in my message loop and try to restore any lost surfaces. This is true for WIn2000 and XP. On the XP box I have 256MB on the graphics card. Can anyone help? Thanks M Singh.

Problem cleaning up after using vertex buffer.

Postby SkI » Sun, 13 Jun 2004 04:11:01 GMT

Ok.. so I tried to take my first step to create a 3D object with VertexBuffers but I have a problem cleaning up. For some reason, after I do CreateVertexBuffer call and I try to exit the application, it keeps saying "reference count for D3D object is non-null". I am releasing the vertex buffer before I exit the application, and I'm using D3DPOOL_MANAGED for vertex buffer. 
Am I missing an important step here? Tutorial doesn't really have any special clean up either but it works fine for tutorials and samples. If anyone can give me few pointers or things to watch out for, I would appreciate it. Or if anyone can tell me what I"m doing wrong, that would even be better. ^^; Thanks. 

Re: Problem cleaning up after using vertex buffer.

Postby legalize+jeeves » Sun, 13 Jun 2004 04:59:23 GMT

[Please do not mail me a copy of your followup]

"=?Utf-8?B?SkI=?=" < XXXX@XXXXX.COM > spake the secret code
< XXXX@XXXXX.COM > thusly:


You must have outstanding references to the device, or an object on
the device.  If you have the debug runtime installed, it should be
telling you exactly what resources you haven't released.
-- 
"The Direct3D Graphics Pipeline"-- code samples, sample chapter, FAQ:
          < http://www.**--****.com/ ~legalize/book/>
	    Pilgrimage: Utah's annual demoparty
               < http://www.**--****.com/ >

Re: Problem cleaning up after using vertex buffer.

Postby SkI » Sun, 13 Jun 2004 06:43:01 GMT

> You must have outstanding references to the device, or an object on

I did run it with debug runtime but it just said "D3D Object" has not been properly cleaned up. The reason I think it's related to vertex buffers is because my application works fine without any problem until I add that CreateVertexBuffer line. 
(I've commented out everything new below CreateVertexBuffer call and it still has the same problem)
So I was wondering if there's a special clean up procedure to perform on the device to properly release the vertex buffer. And also, if debug runtime is able to give me exactly what resource I'm not releasing right, I would like to know where I should look for that information. Debugging comments just told me I had a "D3DObject" not properly cleaned up, which wasn't very helpful. 
Again, Thanks for your comments, Rich.

Re: Problem cleaning up after using vertex buffer.

Postby legalize+jeeves » Sun, 13 Jun 2004 07:42:35 GMT

[Please do not mail me a copy of your followup]

"=?Utf-8?B?SkI=?=" < XXXX@XXXXX.COM > spake the secret code
< XXXX@XXXXX.COM > thusly:


OK, please post the code you are using to create the VB and to release
it.
-- 
"The Direct3D Graphics Pipeline"-- code samples, sample chapter, FAQ:
          < http://www.**--****.com/ ~legalize/book/>
	    Pilgrimage: Utah's annual demoparty
               < http://www.**--****.com/ >

Re: Problem cleaning up after using vertex buffer.

Postby SkI » Sun, 13 Jun 2004 15:06:01 GMT

ah, ha! I think I've solved the mystery.
Problem was with my device creation. I was automatically configuring my device according to device CAPS and I was setting PURE_HARDWARE_VP as behavior flags. After I forced behavior flag to be MIXED, problem went away. I became little bit curious though. Docs doesn't mention any warnings about using PURE_HARDWARE_VP with vertex buffers. Why is this a problem? More specifically, why do I get the not properly cleaned up error with this setting? Does this mean vertex buffer can't be used with PURE_HARDWARE_VP? 
Any comments will be appreciated. Thanks.





Re: Problem cleaning up after using vertex buffer.

Postby SkI » Sun, 13 Jun 2004 15:43:01 GMT

Umm.. Nevermind my previous post. I really wasn't cleaning up where  I thought I was. It just happened to solve the problem for a little while when I switched the behavior flag. I now know why I was getting the resource not cleaned up error. I am still curious about vertex buffer's compatibility with PURE_HARDWARE_VP flag. (Of course I no longer believe this flag was causing the improper cleanup of resources.)






Re: Problem cleaning up after using vertex buffer.

Postby legalize+jeeves » Mon, 14 Jun 2004 11:38:40 GMT

[Please do not mail me a copy of your followup]

PURE doesn't have anything to do with resource tracking, leak
detection, etc.
-- 
"The Direct3D Graphics Pipeline"-- code samples, sample chapter, FAQ:
          < http://www.**--****.com/ ~legalize/book/>
	    Pilgrimage: Utah's annual demoparty
               < http://www.**--****.com/ >

RE: Problem cleaning up after using vertex buffer.

Postby aGVyYnNz » Fri, 18 Jun 2004 07:00:02 GMT

Hi,

I wouldn't be so sure that it's the vertex buffer, here is a little experience I had with D3D just 2 weeks ago.

I made an addition to my little demo program.  Then started getting that message just like you.  At first I suspected its the new texture resource.  I made it clean up but no luck.  After about an hour or so I realized it wasn't the newly added texture resource but something else.

Thinking about why it happend, I realized this is a reference count, and it complains when the number is not 0.  This means it could be negative and it might trigger this message.  Perhaps you are releasing something twice? 





Similar Threads:

1.Changing vertex color after vertex buffer and index buffer definition

Hi,

Say you have this custom vertex structure:

struct CUSTOMVERTEX
{
	float x, y, z;
	DWORD color;
};

Is it possible once you've defined values for a vertex 
buffer using that structure to subsequently change the 
color for a vertex that you defined? If so, how?

Thanks :)

2.Vertex buffers, using glut

Hi,

I'm trying to work out how to use vertex buffers using the 
GL_ARB-vertex_buffer_object extension.  I have been working in linux 
using glut, but trying to stay as portable as possible.

Anyway, I'm trying to work out how to load the functions needed.  There 
are lots of web resources on how to do it using SDL library, but I can't 
find how to do it without using SDL.

I thought I could use glutGetProcAddress(...), but on one linux setup it 
said 'glutGetProcAddress' undeclared even though I included <GL/glut.h>.
I also was not sure what type it would return.

I see in Windows it's something like
PFNGLBINDBUFFERARBPROC glBindBufferARB = (PFNGLBINDBUFFERARBPROC) 
wglGetProcAddress("glBindBufferARB");

If I just use glXGetProcAddress, can I do something similar?  What do I 
use as the return type (instead of PFNGLBINDBUFFERARBPROC)?

Thanks for your help.

3.Animation using Vertex Buffer Objects

If I want to animate a large model stored in a VBO, does that mean I
have to map the buffer to change the value every frame of animation?
It seems like that would drop the framerate considerably.

4.vertex buffer, index buffer

there is setup time internally both for a VB and for a particular 
FVF/components. its less if you stay with the same format/stride, but there 
is still some cost with switching just the VB.

minimize it if you can without heroic rewriting, but dont worry about it if 
its a huge rewrite unless you measure thats a significant factor in your 
particular performance signature.

tools are required for measurement. VTune or other static performance 
analysis tool and a dynamic analysis tool like Pix that shows your API usage 
per frame is good, you can zero in on most issues that way.

"Hanna-Barbera" < XXXX@XXXXX.COM > wrote in message 
news: XXXX@XXXXX.COM ...
> Hi,
>
> Does switching VB and IBs a lot cost too much?
> Is it better to store multiple things to be rendered in one VB/IB?
> Is it considered one of the costliest things, that must be dealt with.
> What about the size of the buffers.
> I know 16 bit indices are recommended, which is what I use.
>
> I know my question is abstract, but I would like to know in relative 
> terms,
> compared to swithcing textures, switching shaders, and so on.
>
> Right now, my engine may be switching texture, and VB and IB per object.
> Shader are not switched so often cause the object's share the same shader.
>
> Thanks
>
> 


5.Vertex buffer problems

6. performance problem of the vertex buffer

7. Large Vertex Buffers and Vertex Streams?

8. Vertex Arrays, Vertex Buffer Objects



Return to Win32 Programming

 

Who is online

Users browsing this forum: No registered users and 22 guest