Problem cleaning up after using vertex buffer.

Win32 Programming

    Next

  • 1. directdraw and windowed mode question
    Hi all, Is it possible to adapt a full screen directdraw application (game) to run in windowed mode and make it behave exactly like the full screen version. I read somewhere it's much slower because it is not really direcdraw but gdi and it's not possible to use a double buffer. But i couldn't find that much information on it, and like to know if it makes sense to do this (or if DD is basically a full screen only API). And if so where i can find information on what modifications i should make to the (c++) source code to make it work in a window. Thanks for any help with this. Best regards, Rick D.
  • 2. X-file texture filenames and unicode
    I am using the unicode setting, so I can use the DXUT framework. It seems that the filename stored in the D3DXMATERIAL structure is defined as LPSTR (char*), and there is no unicode version (like D3DXMATERIALW). When loading a x-file, I convert the filename to unicode so it will work with the D3DXCreateTextureFromFileW function. My question is, must the texture filename always be converted to and from unicode when loading or saving to an x-file? If I create a new x-file, must I always convert the unicode filename (that will come from the save-as dialog) to multibyte? If not, how could I know when loading an x-file, what the format of that texture file name is? Thanks.
  • 3. PCI Express cards
    Hi, I need to render 80000+ objects in one second but most of them are just simple boxes with 6 sides and 2 tris on each side. My Radeon 9600 card can afford that,(about 10M tris) but at very low frame rate (~3 fps very sloooooow). The other objects are more or less optimized. Besides that, I have some infrastructure and several skinned objects to load in. I'd like to ask if I switch to a PCI Express based Geforce 7800 GTX card, how great the performance can be improved? I'd like to have at least 30fps... Is that possible? (I guess I have Culling turned on, also I'd like to split that into 2 views from MFC as well, ballistic?) I saw some hi-polygon app like Doom 3, which can only have 30fps with a Geforce 7 card...I'm not sure!!!! (We can accept some fairly low polygon meshes). So can a Radeon 9600 perform at 30fps in this scenrio? Any comments are welcome!!!! Thanks Jack
  • 4. Convert a bitmap or jpg to an 8 bit raw file format.
    Hi every one. Does anyone know how to create an 8 bit raw file from a bitmap? The idea is to generate landscapes from those raw files and also to automatically generate the raw and then create the terrain. Thanks in advance. Cubaconn
  • 5. bump mapping dot3 tangent space
    I have bump mapping using dot3 very close to working. The problem I have is the light seems to subtract light instead of adding light. Now, instead of figuring out the tangent space for each polygon, I am just using the inverse matrix of my polygon to put the light into tangent space. Is this not the correct way to do it? I have a polygon with -1 for the normals. I do not tranform my polygon at all. Right before drawing the poly, I get the world matrix and make an inverse matrix from it. Then, I get the position of my light and mutiply it by this inverse matrix to put it into tangent space. Then, I take the vector from each vertex to the light and normalize this. I convert it to a DWORD and put it in each vertex diffuse component and then draw the polygon. Is there more to putting the light into tangent space? I looked at an example and looks like it is finding the tangent space x,y,z for each vertex. But, I guess I don't understand why I would need to do it for each vertex. Thanks!

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 41 guest