|
Thank you
AfxGetMainWnd()->ShowControlBar((CControlBar*)pMyDlgBar,TRUE,0);
it solved my problem by setting the second parameter TRUE/FALSE
we can change the visibility of the Dlgbar
ok
On this link you will find the new free courses
offered by microsoft for VS2005.
http://www.financialexpress.com/latest_full_story.php?content_id=107645
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
-----> hr = db.Open(_T("SQLOLEDB.1"), dbinit);
if (FAILED(hr))
{AfxMessageBox("Failed To Connect Datasource"); }
My code is terminating on above line please help.
Actually senior programmer who developed code left for me to debug
help.
|| ART OF LIVING ||
|
|
|
|
|
please answer my above question
|| ART OF LIVING ||
|
|
|
|
|
42
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Will you join conversation to solve problem
|| ART OF LIVING ||
|
|
|
|
|
You're question doesn't have enough information to make sense, or expect a usefull answer.
You posted about 50 lines of code but the error is on the 3rd line - why do we need to see the rest at this point.
There are many things that could be wrong that have nothing to do with the code.
You should check that the database is setup right and explain what you have checked.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Send the details pls
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
void OleList::ExecuteQuery(CString str,bool refreshcol,bool fillcheckbox)
{
ptr=new CObArray;
USES_CONVERSION;
CDataSource db;
-----> HRESULT hr = db.Open(_T("SQLOLEDB.1"), dbinit);
if (FAILED(hr))
{
AfxMessageBox("Failed To Connect Datasource");
return;
}
CSession session;
session.Open(db);
int i=0;
CCommand product;
CString temp=GenerateSQL();
LONG row;
char tt[50];
hr=product.Open(session,temp, NULL, &row, DBGUID_DEFAULT, true);
if (FAILED(hr))
{
AfxMessageBox("Failed To Create Table");
return;
}
if(refreshcol)
{
// coltype.RemoveAll();
DBTYPE pType;//=NULL;
for(ULONG j=0;j< product.GetColumnCount() && j < colsize;j++)
if(product.GetColumnType(j+1,&pType))
coltype->SetAt(j,pType);
}
i=0;
if(product.MoveFirst()==S_OK)
do{
CStringArray* sarr=new CStringArray;
sarr->SetSize(colsize);
for(int k=1;k<=colsize;k++)
{
CString st;
switch(coltype->GetAt(k-1))
{
case DBTYPE_STR :
{
char* tm=(char*)product.GetValue(k);
st=A2T(tm);break;
}
case DBTYPE_DBTIMESTAMP : st=GetTime(product.GetValue(k)); break;
case DBTYPE_BOOL : GetBool(product.GetValue(k),&st); break;
case DBTYPE_R4 : GetFloat(product.GetValue(k),&st); break;
case DBTYPE_R8 : GetDouble(product.GetValue(k),&st); break;
case DBTYPE_I4 : GetLong(product.GetValue(k),&st); break;
case DBTYPE_I2 : GetSort(product.GetValue(k),&st); break;
case DBTYPE_UI1 : GetUInt(product.GetValue(k),&st); break;
}
/*if(k==1)
InsertItem(i,st);
else
SetItemText(i,k-1,st);*/
st.TrimRight();
sarr->SetAt(k-1,st);
}
ptr->Add(sarr);
i++;
product.FreeRecordMemory();
}while(product.MoveNext()==S_OK);
if(checkarr!=NULL)
checkarr->RemoveAll();
checkarr=new CWordArray;
checkarr->SetSize(i);
for(int m=0;m checkarr->SetAt(m,fillcheckbox+1);
SetItemCountEx(i);
//char tt[50];
//AfxMessageBox(itoa(i,tt,10));
// SetItemCount(i);
Invalidate();
m_HeaderCtrl.listsize=i;
m_HeaderCtrl.checkarr=checkarr;
product.Close();
session.Close();
db.Close();
m_HeaderCtrl.ptr=ptr;
SetCursor(hcurSave);
}
My code is terminating on above line please help.
Actually senior programmer who developed code left for me to debug
help.
|| ART OF LIVING ||
-- modified at 1:25 Saturday 5th November, 2005
|
|
|
|
|
I Have Send You the details
|| ART OF LIVING ||
|
|
|
|
|
Probably there is some error with
the OLE DB you are using.
Did u find out that the connection
is working proper .
Ther is one more method CEnumerator which
prompts the user with a locator dialog box.
from wich u can select ur connection and
try opening the database.
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
Actually He has used this code in three more places.
And I am mimicing his code.I have gone through his code
in and out.Only what I have sent you that much is inly related to database connectivity. And in same project at other three locations it is working perfectly
|| ART OF LIVING ||
|
|
|
|
|
Does it? I can't get it to work...
I'm running the Feb 2003 SDK. It there maybe an update that fixes this?
Thanks!
swine
[b]yte your digital photos with [ae]phid [p]hotokeeper - www.aephid.com.
|
|
|
|
|
Not that familiar with OpenGL - but had fun(!) with this type of thing before.
First thing to check is your graphics card. Does it support alpha? If so then check the configuration setup in the control panel. You may also want to check that you have the latest drivers from your manufacturer.
I once spent hours trying to get anti-aliasing working on my laptop's card
Graham
|
|
|
|
|
using alpha is a combination effort. In otherwords you cannot simply use alpha transparency, you first have to enable it, and also provide a function for method of processing alpha. The whole process is called blending since you are using a source color value, an alpha transparency, a function for combining the two into a new blended color.
Try looking here for an example, it is my personal favorite OpenGL site: NeHe[^]
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
Is it possible to use alpha with OpenGL??
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
Thanks a lot, that really helps!
He says "You should SORT THE TRANSPARENT POLYGONS BY DEPTH and draw them AFTER THE ENTIRE SCENE HAS BEEN DRAWN, with the DEPTH BUFFER ENABLED, or you will get incorrect results."
How do I determine the depth of the object? What is the proper function to use to get the distance between the viewpoint and the object?
Thanks,
swine
[b]yte your digital photos with [ae]phid [p]hotokeeper - www.aephid.com.
|
|
|
|
|
distance is distance is distance.... You can project the xyz data into viewer references, in which case you will get your depth as a valid number. Or you can just use the old distance formula d=sqrt(deltax*deltax+deltay*deltay+deltaz*deltaz).
however since all you need is a compare and sort, drop the sqrt. The square of the distance won't make one distance shorter than another.
The author is primarily referring to the fact that the programmer often has knowlege of what he is doing that the computer does not. So you can order your logic to provide the computer with an easier time. You generally do not have to depth sort opaque objects, draw them all and let the hardware z-buffer sort them out. So then you are left with your alpha transparent objects. Some of them you may already know their order.
When you have limited knowledge of what you are going to draw and when (or simply providing the power of flexibility), that is when you start getting into game-engines and scene-graphs. If you have n number of objects of unknown type, and unknown complexity as far as alpha-objects, you toss all n-objects onto a scene-graph and issue a scene-graph draw command. The scene-graph-API handles sorting, culling and other tasks that will have to be performed every time you draw (as objects move in relative position to each other and on their own axis -- a plane doing a barrel roll with a transparent glass canopy for example will generate a new z-sort every time).
www.openscenegraph.org[^] has one of many scene graphs (there are a dozen I could rattle off off the top of my head -- google on opengl scenegraph)
www.delta3d.org[^] has one of many gaming engines (based on openscenegraph API for a core), google will again turn up many more (some for a cost).
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
-- modified at 15:19 Monday 7th November, 2005
|
|
|
|
|
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.
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?
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?
[b]yte your digital photos with [ae]phid [p]hotokeeper - www.aephid.com.
|
|
|
|
|
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)
|
|
|
|
|
|
|