|
Hi everybody!
I'm trying to find an answer on how to render a text in OpenGL and having it always in front of every object independingly of its z value. The text is placed using glRasterPos3d()..
(I don't want to use glOrtho() because I want the text to be moved in relationship with the camera)
Thanks for every answear!
|
|
|
|
|
You can disable the z-buffer by calling glDisable(GL_DEPTH_TEST), render the text, and re-enable z-buffer.
|
|
|
|
|
I have a dialog based class named CJKDlg, with a tree control with name treeTracks.
In the JKDlg.h i have defined the following structure:
struct _itemData
{
CString strData;
};
In the OK click event i have the following handler:
void CJKDlg::OnBnClickedOk()
{
CStdioFile stdFile;
CString str;
if(! stdFile.Open("test.txt", CFile::modeRead))
{
AfxMessageBox("Cannot find initialization file", MB_OK, MB_ICONSTOP);
return;
}
TVINSERTSTRUCT tvInsert;
tvInsert.hParent = NULL;
tvInsert.hInsertAfter = NULL;
tvInsert.item.mask = TVIF_TEXT;
HTREEITEM hAlbum, hItem;
char ch;
CString albumTitle, trackTitle, trackPath;
_itemData* pItemData = new _itemData();
while(stdFile.ReadString(str))
{
ch = str.GetAt(0);
if(ch=='$')
{
albumTitle = str.Right(str.GetLength()-1);
tvInsert.item.pszText = albumTitle.GetBuffer(albumTitle.GetLength());
hAlbum = m_treeTracks.InsertItem(&tvInsert);
pItemData->strData = "OK";
m_treeTracks.SetItemData(hAlbum, DWORD(pItemData));
}
}
delete pItemData;
}
In last a double-click event handler for the tree control:
void CJKDlg::OnNMDblclkTreeTracks(NMHDR *pNMHDR, LRESULT *pResult)
{
HTREEITEM hItem = m_treeTracks.GetSelectedItem();
ASSERT(hItem);
_itemData* pItemData = new _itemData();
pItemData = (_itemData *)m_treeTracks.GetItemData(hItem);
if(pItemData)
{
TRACE1("%s\n", pItemData->strData);
}
delete pItemData;
*pResult = 0;
}
The TRACE macro dose not display the "OK" string. Instead in the output window a white space displayed.
Can anyone help me with this please?
|
|
|
|
|
johnnyXP wrote:
m_treeTracks.SetItemData(hAlbum, DWORD(pItemData));
You are inserting the same pItemData for each node in the tree. Is that intentional?
johnnyXP wrote:
delete pItemData;
This is why nothing shows up.
johnnyXP wrote:
_itemData* pItemData = new _itemData();
This statement is unnecessary in OnNMDblclkTreeTracks() . Memory was allocated in OnBnClickedOk() .
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Daim you are right! The data is not the same for each node. I do that just to simplify the question and the code.
Thanks a lot for your time.
|
|
|
|
|
Hey,
i build a nice custom control (::from CWnd). It works perfect on dialogs but can't print it.
I tried to create the control in my CView::OnPrint function --> Success.
But I never come to my OnPaint function. How can I print my control? Do I have to implement a special function with a parameter-handle to my printing DC?
|
|
|
|
|
Hi ,
I would like to draw opengl inside the frame of a simple html page running through IE or Firefox.
I already can draw opengl on windows Desktop but i do not know how to draw on internet directly.
please post some code to achieve that.
thanks.
|
|
|
|
|
If given a region (could be CRgn or even just an area described by a CRect), is there a way to check if that region only contains background color (nothing really drawn in there, i.e., no characters, dots, etc)? The simplist way I could think is looping through the region and getting each pixel via the CDC::GetPixel () method, and checking it against the background color. I am basically looking for a way to determine if something is drawn in a specific area.
I was hoping if there was a more "elegant" solution. Searches both here and on the 'Net as a whole seemed to turn up nothing regarding this.
Thanks
Steven Konopa
|
|
|
|
|
How can I print without Doc/View advantage(i.e from a menu for example, or dialog)
Thanks
I learn my self
|
|
|
|
|
What is it that you are wanting to print?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Hello Sir,
I know to print taking adventage of doc/view.
I want to make a menu item is name "Printing " where there are many lists as item. And when I click on one item (like list of food) this list is printed
Thanks
|
|
|
|
|
Look for:
StartDoc()
StartPage()
TextOut()
EndPage()
EndDoc() You'll likely need others, but these are a minimum.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I am looking for solution to my problem. Then help me clearly.
I don't know where to look for StarDoc()
|
|
|
|
|
I am looking for solution to my problem. Then help me clearly.
I don't know where to look for StarDoc()
And give my one example if you have it
|
|
|
|
|
I see, they are CDC fonctions. But how to use it, give me example
|
|
|
|
|
|
thanks a lot for your help
|
|
|
|
|
i'm fresh for vc++. Could anyone tell me where can learn the 1st steps and so on to build a gui? What book is easy to understand? thx a lot.god bless u all the time.
|
|
|
|
|
|
|
Hello, I´m Newbie in VC++, but i´m prgramming c++ very well.
I want to write a browser application with the feature to browse over proxy. who can help me and give tips, which class i have to use.
what about the problem with the proxy?
I´m using Visual C++ 6.0
thanks a lot.
|
|
|
|
|
How to get the name of the files in the zip file!
--------------------------------------------------------------------------------
Hello ,I want to know the file names in the zip files. Such as, I have the "example .zip " files ,it is zipped by the book.jpg and the test.xml.If I
release the "example.zip" to the "C:\\test",how i get the path --"C:\\test\booka.jpg" and "C:\\test\test.xml".If I don't release the example how can I get to know the names of the files in it??
|
|
|
|
|
|
I have written a code that has a window procedure for the main window. I trapped WM_CHAR message and wrote this code:
98 ......
99 case WM_CHAR:
100 MessageBox(hwnd, TEXT("KJHGKIF"), TEXT("KHTIUYT"), MB_OK);
101 return 0;
102 ......
(hwnd is a handle to the main window)
when run, I press a key and see a message box. at this time, window procedure is stopped at line 100. when I move messagebox, the client area of the main window is repainted. meaning that WM_PAINT is invoked. how can it possible? window procedure is running at two points?
|
|
|
|
|
Yes it is possible (and normal). messagebox has a dialog box loop ( something that reads message from the queue and dispatches them) which does not exit until you press one of the buttons. All modal dialog boxes have this. This allows other windows to be repainted when you move your dialog box (or to deal with timers or all sorts of events).
It looks like multi threading but it is not!
|
|
|
|