|
Hi,
from what you say I guess you don't really have a rendering-loop. See, your OpenGL image is drawn this way:
1. Clear screen (glClear(), etc.)
2. Draw allvisible objects in a certain order (lots of code)
3. Wait until OpenGL finished drawing (glFlush())
4. Swap front/back buffer to make the newly drawn objects visible (SwapBuffers())
So you have to remember a list of objects you want to draw. When one of your buttons is clicked, it should do sth like that:
myRenderList.Add(someObject);<br />
myOpenGLControl.Invalidate();
Note: Do NOT put any OpenGL commands in a button. You should have one and only one loop to do all the GL stuff!
Managing scene information (all objects, how to describe them, whether they are visible, etc.) is the hard part - the OpenGL commands are comparatively simple. (See the term 'scene graph' for more on that).
For text rendering, check NeHe's tutorial[^]. He presents three options. You might want to take a look at EaseSDK[^] to make things easier. It includes CeGUI, which supports not only text rendering, but real GUI elements such as buttons, scroll bars, etc.
Regards,
Chris
"Obstacles are those frightening things you see when you take your Eyes off your aim"
- Henry Ford
Articles
Blog
|
|
|
|
|
Greetings,
This is a newbie question. After I have installed Platform SDK 2003 on my XP, the compiler couldn't find "dshow.h". Then, I specifically picked up DirectShow from the SDK and installed it once again. It still couldn't find the header. I have searched the entire "Programe Files" folder and there is no "dshow.h". Where did it go?
Thanks,
Best,
Jun
|
|
|
|
|
After googling a bit, I seem to find a solution. Basically, I have to installed DirectX 9.0 Complete SDK, not other upgrades
Best,
Jun
|
|
|
|
|
Just curious, does Vista support MDX straight off, or does it have to be installed by the user?
|
|
|
|
|
I tried simple pixel-based skin detection using YCrCb color space, It worked fine but not for every Image, i guess it's becoz of the Thresholds (Cr,Cb)i have selected, Can any 1 tell me or refer me a fast algorithm becoz mine take lots of time in detection.....???
(Jameel)
|
|
|
|
|
Does anyone know how to read frame types from mpeg file?
I want to know if this frame is frame I, P or B
Some source code would be appreciated
Thanks
|
|
|
|
|
Does anybody know if DXSmith is a good wrapper for DirectX? Before I get too involved in implementing it, I mean. ?
|
|
|
|
|
hi all...
we are having a problm in our graduate project... in some phase in the project we needed to do meshing and triangulation for a person in a 2D image, wihch did succefully, thx God (now we have the vertices and triangles connecting them)... the next step is to prform texture mapping to our generated mesh... but after we set texture positions rendering the textured mesh... the output of texture mapping on my laptop wasn't properly drawn... although it's working properly at our supervisor's pc!! can anybody plz hlp us find a reason for this...
I'm sending a link having the original img and the output of the texture mapping on my laptop...
http://www.geocities.com/naroqueen/texture.html
we are using DirectX 9.0 in our texture mapping
|
|
|
|
|
Hi naroqueen
My first thought is that you're laptop sux. But perhaps a more thought out response is to ask what graphics card you have in your laptop. It's obviously approximating the texture, but not shading across primitives. The fact that it works on your supervisors PC suggests the code is good, and that it's your laptop that is the problem... So look at the differences in system and setup.
Gavin
|
|
|
|
|
sorry I don't know what do you mean by "you're laptop sux"...
secondly my display card is "Mobile Intel(R) 945GM Express Chipset Family" with graphics accelerator... my supervisor is working on wondows vista and I'm working on win xp media center..
may this affect our problem???
|
|
|
|
|
naroqueen wrote: Mobile Intel(R) 945GM
Ouch! This isn't a good card to use with intensive graphics. Generally, you want a bit more "oomph" than this.
|
|
|
|
|
naroqueen wrote: "Mobile Intel(R) 945GM Express Chipset Family"
These are know to have numerous issues even though intel tends to talk up their capabilities. If you can, get access to a hardy desktop machine with a solid dedicated gpu.
A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects.
- -Lazarus Long
|
|
|
|
|
Hello,
I am new to DirectX.I didn't know about mesh picking in directx.
http://www.experts-exchange.com/Programming/Game/Q_21257512.html[^]
I referred above site.But this code not performing mesh picking.When I pick cube mesh using mouse, I need to highlight selected part triangle. How to do it? Please anyone help me. Thanks in advance.
|
|
|
|
|
Hi,
I'm just about to look at mesh-picking myself, so when i work it out, I'll post my findings.
Gavin.
|
|
|
|
|
Well i got the mesh-picking working. But as i understand it, if you want to pick primitives, you have to write your own collision code, accessing the meshes vert collection. I was going to work it out until i decided that it would be easier to just break my terrain down into meshes. So until i have a more specific need to pick primitives, you're on your own.
|
|
|
|
|
Hai Gavin W,
I tried mesh picking using airplane.x file.I render the airplane in wireframe(in drawmesh function).I call below MeshPick function in Mouse down function.
private bool MeshPick(Mesh mesh, int x, int y)
{
Vector3 v3Near = new Vector3(x, y, 0);
Vector3 v3Far = new Vector3(x, y, 1);
IntersectInformation closestHit;
v3Near.Unproject(device.Viewport,device.Transform.Projection,
device.Transform.View, device.Transform.World);
v3Far.Unproject(device.Viewport, device.Transform.Projection,device.Transform.View,device.Transform.World);
v3Far.Subtract(v3Near);
if (mesh.Intersect(v3Near, v3Far, out closestHit))
{
return true;
}
else
return false;
}
How to get intersected vertices and how to Highlight intersected triangle? I have no idea? Please help me.Thanks in advance.
|
|
|
|
|
Hai Gavin W,
I tried mesh picking using tiger.x file.I render the tiger in wireframe(in drawmesh function).I call below MeshPick function in Mouse down function.
private bool MeshPick(Mesh mesh, int x, int y)
{
Vector3 v3Near = new Vector3(x, y, 0);
Vector3 v3Far = new Vector3(x, y, 1);
IntersectInformation closestHit;
v3Near.Unproject(device.Viewport,device.Transform.Projection,
device.Transform.View, device.Transform.World);
v3Far.Unproject(device.Viewport, device.Transform.Projection,device.Transform.View,device.Transform.World);
v3Far.Subtract(v3Near);
if (mesh.Intersect(v3Near, v3Far, out closestHit))
{
return true;
}
else
return false;
}
How to get intersected vertices and how to Highlight intersected triangle? I have no idea? Please help me.Thanks in advance.
I am waiting for your answer.please help me.Thanks in advance.
|
|
|
|
|
Hai,
I am beginner in the development of filters using DirectX.We are in the process of developing codecs for mpeg2/mpeg4. May i know how we can find the stream type whether it is a audio stream, video stream or an data stream using FOURCC.
Thanks and Regards
Angeline
|
|
|
|
|
Hi Everyone
Can someone please assist me with the following : I have attached a basic paint app. The zooming works fine, but the rulers disappear when I scroll horizontally or vertically. I need the rulers to stay fixed like for example MS Word's rulers.
If anyone would be so kind as to take a look, I can mail you the app.
Thank you very much
|
|
|
|
|
Draw the rulers outside of the area you draw the image in, so they are not affected by the zoom action.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi,
I have a simple DirectX app which raises a NullReferenceException when i exit the app, the exception is raised at the vDevice.Clear(...) instruction. What i don't understand is how that code can even be reached when i have < if (vDevice != null) > enclosing it. This seems illogical to me.
if (vDevice != null)
{
// Render DirectX components
vDevice.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.SlateGray, 1.0F, 0);
vDevice.BeginScene();
...
If anyone can help, it would be much appreciated.
Gavin
PS. Oh and hi everyone, this is actually my first post, I'm studying 3D Animation but enjoy fiddling with C#/directx in my own time.
modified on Monday, February 11, 2008 8:12 PM
|
|
|
|
|
vDevice is null?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
My debugging skills are probably not very developed, but yes, that's what it looks like to me. Funny thing is, now it doesn't throw that exception in windowed mode, but if i start in fullscreen mode the exception will be thrown. It looks like at the breakpoint (at the vDevice.Clear instruction) -- that's where the yellow arrow is ! -- the device, textures and VertexBuffers are all disposed, as should be the case during termination. But still, the code logic says that the vDevice.Clear instruction wont be reached if vDevice == null.
I now think that the yellow arrow indicates the next instruction to be executed, as indicated by it's tooltip. Though it is the vDevice.Clear() line that is highlighted in yellow and has the Exception Helper attached. I consider the following possibilites :
1. The device is being disposed after the (device != null) test and before the next instruction. That seems ridiculous to me, and would render code logic breakable.
2. The (device != null) test is not working as i expect. Is there something i've forgotten about null comparisons.
3. The device still exists, but it is the device.Clear method that is raising the Exception because although the device exists, it is disposed and has no PresentParams.
Just typing this 3rd option, im thinking that's the case. And I'll try either setting device=null after it is disposed or setting an appState=suspended after device is disposed and test the appState instead.
|
|
|
|
|
Have you tried a try/catch and setting a breakpoint in the catch so you can see what is null ? Perhaps the method itself can throw that exception ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I think you're right ! I think it is the method itself that is raising the exception. I wasn't thinking properly about the Device still existing while being disposed, which would raise an Exception. Clearly I have to properly handle a lost device, which I haven't been able to do properly.
Thanks guys
|
|
|
|
|