|
Swinefeaster wrote: Well that's the whole thing really. The user can set the camera angle viewpoint anywhere they want, inherently reversing the order of the objects in my scene. So I need a generic way of sorting these objects by calculating the depth from the camera.
Well, yes and no. OpenGL is a programming API, so it is designed for your flexibility and power, but it is very low-level. If you are trying to make sure a user can drive a car, OpenGL is the transmission and engine block. When you start talking about making it easy for the user, you are talking higher level stuff, you are talking scene-graphs and gaming engine APIs.
Swinefeaster wrote: I would have liked most to have a general sort for this. I guess there's no OpenGL option I can enable for this, huh?
Use any sort. OpenGL doesn't remember objects from frame to frame, in fact it doesn't even have any knowledge of "objects" per se. OpenGL knows triangles and can draw them in many different references with multiple textures, color blending methods, etc. But OpenGL doesn't know a car from a baseball bat. If you build a vector using STL and sort it using your favorite sort, you have your beginnings of a gaming engine/storage system. If you want to drop something in and not have to repeat it again everyframe forever, again you are talking scene graphs. nVidia has a scene graph, there is several open scene graphs (though only one by that name).
Swinefeaster wrote: And what if you don't know (or don't wanna know) why objects are transparent and which are not...? Or what if some objects are partially transparent or have gradient alphas?
Again, you are talking scene graph material. OpenGL knows the basics, triangles, lines, points, colors, textures, etc. Even the shaders are fancy ways of coloring a triangle. Don't get me wrong, both DirectX and OpenGL are incredibly powerful, but they are much lower level than you are talking about.
With open scene graph you do just drop an object (not triangle lists, but a physical object) into a node. The scene graph breaks the object into triangles of opaque and transparent nature and zsorts appropriately. You then move the object as you would moving a plane or a car, or a cartoon character, by manipulating centers of parts (rotate, translate, scale, etc). With a scene graph or gaming engine, you think in object/part rather than every triangle. Although a single point, or a single triangle is still considered an object, so you can always go lowerlevel from the high.
Jeff
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
I really appreciate your input... But, I have tried everything I can think of, and still nothing works. I can get two cubes to appear, but they don't blend correctly no matter what I do.
For now, I would just like one of them to be semi transparent and the other one opaque. I'm assuming if I don't sort them, then they should be correct from at least one viewing angle. But the opaque cube is always opaque, and the semi transparent cube seems to alpha blend with the black background ok, but they don't blend together no matter what the viewing angle.
I still can't find a simple example showing correct alpha blending with two simple polygons --- I don't need any crazy texture mapping with targa files...
The latest I've tried is:
glDepthFunc(GL_LEQUAL);
glEnable(GL_DEPTH_TEST);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glEnable(GL_CULL_FACE);
But that stil doesn't work....
Any ideas???
Much thanks!
swine
[b]yte your digital photos with [ae]phid [p]hotokeeper - www.aephid.com.
|
|
|
|
|
I assume the semi-transparent cube is always drawn first? Then yes, it will blend with the background, then you draw the opaque cube and it will either cover up the semi-transparent cube or it will clip it (as in it will not be drawn due to GL_CULL_FACE). Since you say you are blending with the background, you are in fact blending, period.
you've also partially stumbled across the example where alpha-blending fails to provide a true result in any case. If you draw as whole objects, things start breaking down.
You can help the situation by breaking all objects into triangles and sorting the triangles. At the very least you will want to draw the opaque square first, then draw the semi-transparent, that's a simple object sort, but not always true, especially with large triangles.
There is another method called depth peeling that draws using multi-frame rendering techniques multiple depth slices to cut the scene in many sections drawing piece by piece.
nVidia layers program[^]
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
Ok after trial and error over and over, I found the lucky combination:
glEnable(GL_LIGHTING);
glEnable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);
glDepthFunc(GL_LEQUAL);
if(m_transparent)
{
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_DST_COLOR);
}
With this implementation, it doesn't matter which order the objects are drawn in. However, for some reason it still ignores how transparent an object is --- it is either somewhat transparent, or opaque. Any ideas?
BTW I couldn't get the nvidia samples to work with vc6.
swine
[b]yte your digital photos with [ae]phid [p]hotokeeper - www.aephid.com.
|
|
|
|
|
Choice of your blending function depends on what result you want. Once again, this is point where OpenGL is more than a draw-and-forget system.
Try a couple of these examples for blending and see how they do:
http://www.opengl.org/resources/code/basics/redbook/[^]
http://nehe.gamedev.net/lesson.asp?index=02[^]
http://nehe.gamedev.net/lesson.asp?index=07[^]
(blender.c)[^]
I tend to use the following sequence only for alpha blended objects (inside your if statement)
<br />
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) ;
glEnable(GL_BLEND);
glShadeModel(GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
glDisable(GL_LIGHTING);
glDepthMask(0);
without knowing what you are expecting in the alpha blending, I don't know if you should use my model or another. There are several alpha-blending methods. In fact I used to know where a demo was of all the alpha-blending modes so you could see what each did as an effect and choose the function that was most like what you expected to see. Unfortunately, I have been searching for it without any luck.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
|
|
Finally somebody helps. Thanks Mircea ::- ). I'll take a look.
-= E C H Y S T T A S =-
The Greater Mind Balance
|
|
|
|
|
Nope. It's not useful. That's a call from VB to VC++. I wanted the other way around using the address of a VB function. And it doesn't even work so well, there are several limitations that the code has, not to mention some assumptions that the dude makes and I don't like that. I pass arrays from VB to VC++ using a different, more effective and safe method, but they can't be modified just as I would like. Anyway, I did find other ways, but that particular way (with calling VB from VC++ still doesn't work). Maybe somebody'll figure it out after I post the article.
-= E C H Y S T T A S =-
The Greater Mind Balance
|
|
|
|
|
I am using Visual Studio .NET 2003. I have a solution with multiple projects inside it. Some projects depend on others to build (I added them as references) and the dependencies are correctly set.
I keep getting this error ...
wilogic error LNK2019: unresolved external symbol "public: __thiscall wanderingidiot::Wi_object::Wi_object(void)" (??0Wi_object@wanderingidiot@@QAE@XZ) referenced in function "public: __thiscall wanderingidiot::logic::Wi_charachter::Wi_charachter(void)" (??0Wi_charachter@logic@wanderingidiot@@QAE@XZ)
The solution consists of 3 dll's and an executable. Wi_object resides inside a particular dll ... and I am trying to inhert from it to another class residing in another dll. Any idea what I'm missing over here?
|
|
|
|
|
Use DumpBin /EXPORTS and make sure the class members got exported from the DLl with the
decoration the linker is looking for.
Either they did not get exported with that naming convention, or else you are not trying to import them correctly , in which case your header file needs modification to perhaps imply _import.
Give that a try
|
|
|
|
|
Okay ..
Found about this in MSDN
#define DllExport __declspec( dllexport )
now it seems to be working.
Thankyou.
|
|
|
|
|
I wrote a hook message to record all the messages on the choosen windows(it is choose by the first mouse click)but it did not do right.
//////////globle variable///////////////
#pragma data_seg(".SHARDAT")
static HHOOK hkb=NULL;
FILE *f1;
BOOL bfist=FALSE;
HWND m_handlechoosen;
#pragma data_seg()
//////////////////////////
LRESULT __declspec(dllexport)__stdcall CALLBACK MessageProc(int nCode,WPARAM wParam,LPARAM lParam)
{
PMSG mesg = (PMSG)lParam;
if (nCode>0) {
//get the first window handle choosen
if (bfist==FALSE&&mesg->message==WM_LBUTTONDOWN) {
bfist=TRUE;
m_handlechoosen=mesg->hwnd;
}
//recorder message belong to the handle choosen
if (bfist==TRUE&&mesg->hwnd==m_handlechoosen) {
f1=fopen("c:\\report.txt","a+");
int nLen = ::GetWindowTextLength(mesg->hwnd);
TCHAR *tszWindowName = new TCHAR;
::GetWindowText(mesg->hwnd, tszWindowName, nLen + 1);
if (nLen>0) {
fprintf(f1, "code=0x%X wParam=0x%X lParam=0x%X | msg->hwnd(Window name)=%s msg->message=0x%X msg->wParam=0x%X msg->lParam=0x%X\n",
nCode,
wParam,
lParam,
tszWindowName,
mesg->message,
mesg->wParam,
mesg->lParam
);
}
else
{
fprintf(f1, "code=0x%X wParam=0x%X lParam=0x%X | msg->hwnd(Window name)=Desktop Window msg->message=0x%X msg->wParam=0x%X msg->lParam=0x%X\n",
nCode,
wParam,
lParam,
mesg->message,
mesg->wParam,
mesg->lParam
);
}
delete tszWindowName;
fclose(f1);
}
}
else
{
CallNextHookEx( hkb, nCode, wParam, lParam );
return 0;
}
return CallNextHookEx( hkb, nCode, wParam, lParam );
}
->The result are all the messages....
...Please help me ...
|
|
|
|
|
mcnam wrote: ...but it did not do right.
Ok, and?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
I'm working on a windows ce development project, and on my compact flash card containing the distribution is "the registry file". I want to be able to edit, off-line, this file. According to Windows CE doc, the format is the same as Windows XP, etc.
When I attempt to open the file on my desktop with regedit, it asks me "Would you like to merge this file?" Noooo, I don't want to do *that*, I want to just see what is in it.
Is there a way to open a registry file on disk - I don't want the live version.
Before you say windows ce is windows ce.... imagine if I have an OS disk that won't boot. I remove the disk from one machine and mount the disk in another workstation. Now I can access the registry file on the off-line disk. But can I?
I see nothing in msdn about opening a static registry file.
Ideas?
C. Gilley
Will program for food...
My son's PDA is an M249 SAW.
|
|
|
|
|
Is it a .reg file, or the actual registry (ntuser.dat)?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
In my case, it's a .reg file.
C. Gilley
Will program for food...
My son's PDA is an M249 SAW.
|
|
|
|
|
No why not just open it with Notepad (or equivalent)?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Well, most of it is gobble-dee-gook.. mix of binary and ascii. Dangerous to edit such a beast in notepad. Or, am I missing your point entirely?
C. Gilley
Will program for food...
My son's PDA is an M249 SAW.
|
|
|
|
|
I've never touched Windows CE so its .reg files may be different than what I've worked with on desktops. In either case, the actual registry will indeed be gobble-dee-gook. What does the very beginning of your .reg file look like?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
I think the default action for the registry is to "add" it's content to the existing registry.
you can open the file in a text editor, it's a text file.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
I admit I have not looked at the registry for my xp-pro system. However, the ce registry is most definitely binary, but you can see some text.
C. Gilley
Will program for food...
My son's PDA is an M249 SAW.
|
|
|
|
|
Can u tell me from were to start learning WinCE
I am a VS.6 VC++ programer
Do i start learning .NET ??
or
shall i study EVC++??
Do u know any online resource??
Thank you in advance
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
Vikas,
My application is almost all mfc with bits and pieces of Win32 and ActiveX controls. With the exception of some very specific CE issues, WinCE is pretty much Windows. Some things you need to keep in mind are the user interface aspects of your target device and some os issues (less memory, etc.). Mainly common sense.
If you start with CE 4.2+, then you have the option of .net development.
chg
C. Gilley
Will program for food...
My son's PDA is an M249 SAW.
|
|
|
|
|
I have a program that uses Microsoft's WinSNMP to send traps to a configured receiver when certain error conditions occur. This program was pretty much cobbled together using sealing wax and duct tape, as I know very little about SNMP in practice, but it works well.
Now someone told me that they would prefer to use SNMP informs instead of traps because the latter, based on UDP, have no assured delivery, whereas the former have an aknowledgement/retry/timeout mechanism to "guarantee" delivery.
So I googled on SNMP inform till the cows came home and found a few places that describe what SNMP informs are in a general sense but none that shows exactly how to accomplish it, particularly with WinSNMP. My impression is as described below, and my question to anyone who knows better is whether my impression is correct. If not, can you please point me to how I can accomplish this with WinSNMP?
My impression is that SNMP informs basically consist of the sender sending the trap just as it always did, but saving a copy of the message sent until it receives the acknowledgement, or until the sender, independently of WinSNMP, determines that it time to resend. It appears to me that the acknowledgement is not something handled in WinSNMP at all, but is just any kind of message that the sender of the trap and the receiver mutually agree on that the receiver sends back to the sender to tell him that the trap was received. In other words, it appears to me that SNMP inform is not something supported by WinSNMP as distinct from a trap, but is nothing more than a mutually agreed upon conversation between trap sender and receiver.
Is this true?
Thanks for any information.
|
|
|
|
|