Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
B

braveheartkenya

@braveheartkenya
About
Posts
19
Topics
8
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • OpenGL- Tao- VB.Net simulating motion and zoom
    B braveheartkenya

    Thanks for the information. iv;e taken it into consideration and now i'm using the Draw() method ... and handling resizing. Now i have another problem, which i think is related, coz i'm convinced that there's fundamentally something wrong with my code. Let me try explain it. I have objects drawn into the SimpleOpenGL control onClick of different buttons, but the problem is everytime i click on a button to draw (add) a new object... the previous one disappears. might you know what the problem is? Then another thing. I'd like to put text into the control. Could you point me in the right direction to do this. I read some other guys post about doing it in C# (somewhere near this one)... but i couldnt find some GDITexFont function or sth like that. Your help is highly valued and appreciated.

    Graphics csharp graphics game-dev help

  • OpenGL- Tao- VB.Net simulating motion and zoom
    B braveheartkenya

    Thanks for the information. I'll handle the resize event in a few. Just checking...Is there any fault in not handling it? What do you mean by "invalidate the control?" About the swapping buffers issue... i was working with trial and error to try and see why my code wasnt working...thats why both are there (by mistake). I've removed the swapbuffers() fn now. The solution to my problem i found was to clear the buffer and do 'myGlWindow.refresh' just after the transformation calculations. Don't know why it worked...may be you could explain it to me...

    Graphics csharp graphics game-dev help

  • OpenGL- Tao- VB.Net simulating motion and zoom
    B braveheartkenya

    Hi, I'm new to openGL programming. I'm trying to simulate motion and zooming in and out in an SimpleOpenGLControl from the Tao Framework. I've just begun trying to move an object up and down, but i can't seem to get the object to move. i know i'm missing something but i can't figure it out. I think it has to do with loading the transformed coordinates into a new buffer and displaying the contents from the buffer... but i don't know how to do that. Here's my code: Imports Tao.OpenGl Imports Tao.Platform Imports Tao.FreeGlut Public Class frmMainWin Dim xTrans, yTrans, zTrans As Single Private Sub frmMainWin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load myGlWindow.InitializeContexts() myGlWindow.AutoSwapBuffers = True 'init glwindow Gl.glClearColor(0.0F, 0.0F, 0.0F, 0.0F) 'Glu.gluLookAt( Gl.glViewport(0, 0, 400, 300) Gl.glMatrixMode(Gl.GL_PROJECTION) Gl.glLoadIdentity() Gl.glOrtho(0.0, 10.0, 0.0, 10.0, -10.0, 10.0) Gl.glMatrixMode(Gl.GL_MODELVIEW) Gl.glLoadIdentity() xTrans = 0 yTrans = 0 zTrans = 0 End Sub Private Sub myGlWindow_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles myGlWindow.Paint Gl.glClear(Gl.GL_COLOR_BUFFER_BIT) Gl.glColor3f(0.2F, 0.2F, 0.8F) 'Gl.glTranslatef(0.0F, 0.0F, 0.0F) Gl.glTranslatef(xTrans, yTrans, zTrans) Gl.glBegin(Gl.GL_TRIANGLES) 'Draw a triangle Gl.glVertex3f(0.5F, 1.0F, 0.0F) Gl.glVertex3f(0.0F, 0.0F, 0.0F) Gl.glVertex3f(1.0F, 0.0F, 0.0F) Gl.glEnd() End Sub Private Sub cmdUp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdUp.Click 'MsgBox("up") yTrans = yTrans + 1 myGlWindow.SwapBuffers() End Sub End Class Any help would be greatly appreciated. Thanks

    Graphics csharp graphics game-dev help

  • Form validation - form.length
    B braveheartkenya

    Greetings all! I'm quite new to javascript so i may have some rather silly kind of questions... but anyway here's the problem... I want to loop through all the elements in a form so as to check their values in order to validate the relevant fields, i thought i could get the number of form objects within the form using "formName.length." Then use a loop to go through all the form fields. It seems formName.length is not working for me ... it's returning "undefined" or "0" values. How could i get the number of form objects within a certain form. My code is as follows: [CODE] window.moveTo(100,100); window.resizeTo(300,460); //window.locationbar.visible=false; //window.menubar.visible=false; //window.personalbar.visible=false; //window.scrollbars.visible=false; //window.statusbar.visible=false; //window.toolbar.visible=false; //window.resize=false; //window.resizeable=no; var elementNo; elementNo = document.registrationForm.length; //elementNo = document.registrationForm.txtFirstName.value; var num; num = document.forms[0].length; var counter = 0; var myMessage = "Please ensure that you have filled in the following fields:\n"; var myFieldsAlert = ""; var myAlertFlag="0"; function validate(){ // alert("abc "+elementNo); alert("abc "+num); /**/ while(counter<elementNo){ // if(registrationForm.elements[counter].value==""){ myFieldsAlert += "-"+registrationForm.elements[counter].id+"\n"; myAlertFlag="1"; } if(registrationForm.optGenderM.value!="0" || registrationForm.optGenderF.value!="1"){ myFieldsAlert += "-Gender\n"; myAlertFlag="1"; } counter++; } /**/ /**/ if(myAlertFlag=="1"){ alert(myMessaage+myFieldsAlert); } else{ registrationForm.submit(); } myAlertFlag ="0"; /**/ return false; } [/CODE] Could someone please enlighten me on the issue at hand and propose a solution. (By the way the code is in a HTML page which is called up as a popup). Any help would be greatly appreciated...

    Web Development help javascript html

  • OpenGL & MFC & setfocus
    B braveheartkenya

    This is the DrawGLScene() function called by onPaint() void COpenGLControl::DrawGLScene() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); glRotatef(80.0f,-1.0f,0.0f,0.0f); //GLfloat x_m, y_m, z_m, u_m, v_m; GLfloat xTrans = -xpos; GLfloat zTrans = -zpos; GLfloat yTrans = -walkBias-0.25f; GLfloat sceneRoty = 360.0f - yRotation; glRotatef(lookUpDown,1.0f,0.0f,0.0f); glRotatef(sceneRoty,0.0f,1.0f,0.0f); glTranslatef(xTrans, yTrans, zTrans); /**/ //Turn RIGHT if(myRightButton==true){ //::MessageBox(0,(CString)yRotation,"Turn Right",MB_OK|MB_ICONINFORMATION |MB_DEFAULT_DESKTOP_ONLY); //glRotatef(yRotation,0.0f,1.0f,0.0f); // Rotate The Triangle On The Y axis heading -= 10.0f; //0.22f; yRotation = heading; ::SetFocus(m_hWnd); //DrawGLScene(); //::MessageBox(0,(CString)yRotation,"Turn Right",MB_OK|MB_ICONINFORMATION |MB_DEFAULT_DESKTOP_ONLY); } //Turn LEFT if(myLeftButton==true){ //::MessageBox(0,(CString)yRotation,"Turn Left",MB_OK|MB_ICONINFORMATION |MB_DEFAULT_DESKTOP_ONLY); heading += 10.0f; //0.22f; yRotation = heading; ::SetFocus(m_hWnd); //::SetFocus(this); //glRotatef(yRotation,0.0f,1.0f,0.0f); // Rotate The Triangle On The Y axis }/**/ if(myUpButton==true){ xpos -= (float)sin(heading*piover180) * 0.05f; //0.05f zpos -= (float)cos(heading*piover180) * 0.05f; if (walkBiasAngle >= 359.0f) { walkBiasAngle = 0.0f; } else { walkBiasAngle+= 10; } walkBias = (float)sin(walkBiasAngle * piover180)/20.0f; ::MessageBox(0,"Moving Forward","Move Forward",MB_OK|MB_ICONINFORMATION |MB_DEFAULT_DESKTOP_ONLY); } if(myDownButton==true){ xpos += (float)sin(heading*piover180) * 0.05f; //0.05f; zpos += (float)cos(heading*piover180) * 0.05f; //0.05f; if (walkBiasAngle <= 1.0f) { walkBiasAngle = 359.0f; } else { walkBiasAngle-= 10; } walkBias = (float)sin(walkBiasAngle * piover180)/20.0f; } if(myPageUpButton==true){ //VK_PRIOR lookUpDown-=20.0f; //z-=0.02f; } if(myPageDownButton==true){ //VK_NEXT lookUpDown+=20.0f; //z+=0.02f; } //*************************** // DRAWING CODE //*************************** /**************DATABASE CONNECTION*************/ /* */ HRESULT hr; CoInitialize(NULL); try{ //Create a pointer to a Connection in memory //ADODB::_ConnectionPtr cnSURMPtr; hr = cnSURMPtr2.CreateInstance(__uuidof(ADODB::Connection)); if (FAILED(hr))

    C / C++ / MFC help tutorial csharp c++ graphics

  • OpenGL & MFC & setfocus
    B braveheartkenya

    I have a program where i have created an openGL window within an MFC Dialog using a tutorial on http://steinsoft.net . I have buttons on the Dialog which i want to use to rotate and move (translate) some objects that i have drawn. I implemented some code from http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=10[^] to allow me to move around the objects. The code seems to be almost correct, but there seems to be a problem with the focus, coz something is stealing the focus, and thus the events are not getting executed properly. Could someone please tell me how to get around this. Your help would be highly appreciated Thanks in advance If you need my project to look at it for further clarification, you could post your meail address here and i'll mail it to you...

    C / C++ / MFC help tutorial csharp c++ graphics

  • OpenGL MFC
    B braveheartkenya

    I have an openGL window within an MFC dialog. I've connected to MSAccess as my DB where i pick coordinates which i use to draw GL_LINES and GL_QUADS. I've checked out my code and it seems to be working correctly but nothing shows on the GLWindow. Wne i hardcode values ... it shows sometimes and other times it doesn't. Might anyone know what i'm doing wrong here? Any help would be highly appreciated... My code for connecting and drawing is as follows: /**************DATABASE CONNECTION*************/ /* */ HRESULT hr; CoInitialize(NULL); try{ //Create a pointer to a Connection in memory //ADODB::_ConnectionPtr cnSURMPtr; hr = cnSURMPtr2.CreateInstance(__uuidof(ADODB::Connection)); if (FAILED(hr)) { throw _com_error(hr); } //Create a pointer to a Recordset in memory hr = rsObjectsPtr.CreateInstance(__uuidof(ADODB::Recordset)); if (FAILED(hr)) { throw _com_error(hr); } //Set Connection properties cnSURMPtr2->CursorLocation = ADODB::adUseClient; //Generate connection string _bstr_t dbLocation(L""); dbLocation = (L".\\SURM.mdb"); //Open the connection cnSURMPtr2->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+ dbLocation +";Persist Security Info=False","","",ADODB::adConnectUnspecified); //Open Objects recordset rsObjectsPtr->Open("SELECT * from Objects", cnSURMPtr2.GetInterfacePtr(), ADODB::adOpenDynamic, ADODB::adLockOptimistic, ADODB::adCmdText); //Read from First to Last Record to load into GLWindow if(!rsObjectsPtr->ADOEOF){ if(rsObjectsPtr->GetRecordCount()>0){ //Move to the FIRST record //rsObjectsPtr->MoveFirst(); while (rsObjectsPtr->ADOEOF == false){ //Code to load cordinates in GLWindow _variant_t myCoordinates; //Read from DB myCoordinates = rsObjectsPtr->GetCollect(L"Coordinates"); //myCoordinates = rsObjectsPtr->Fields->GetItem(L"Coordinates")->GetValue(); if(myCoordinates.vt != VT_NULL){ //Change to String and pick each vertex coordinate CString myStrCoords; myStrCoords = static_cast(_bstr_t(myCoordinates.bstrVal)); //if(myStrCoords != ""){ //Determine array size int myArraySize = (myStrCoords.GetLength()/9); //CString singleCoord[myArraySize] = new CString[myArraySize]; CString *singleCoord = new CString[myArraySize]; int tokenCounter = 0; //Put each token into an array element while(myStrCoords.GetLength()>=9

    C / C++ / MFC database graphics c++ game-dev data-structures

  • Message Box being hidden
    B braveheartkenya

    It didn't work, but i got another that did. Replace the MB_SETFOREGROUND with MB_DEFAULT_DESKTOP_ONLY. I don't know what it means, but it brings it on top and freezes the dialog. Any idea how i can bring it to the front but not freeze the dialog?

    C / C++ / MFC tutorial question

  • Message Box being hidden
    B braveheartkenya

    Thanks for the information ... i'll sure take it into account

    C / C++ / MFC tutorial question

  • CDialog and Keyboard events
    B braveheartkenya

    Thanks for the idea ... i'll try it out

    C / C++ / MFC c++ testing beta-testing help

  • Message Box being hidden
    B braveheartkenya

    I've just tried m_Hwnd as follows: ::MessageBox(m_hWnd,"This is the LAST record","Last Record",MB_ICONINFORMATION | MB_SYSTEMMODAL); But its still not coming to the front. Could there be something else wrong?

    C / C++ / MFC tutorial question

  • Message Box being hidden
    B braveheartkenya

    Sorry i'm unfamiliar with how to create or use a handle. Could you please show me how to? Thanks in advance

    C / C++ / MFC tutorial question

  • Message Box being hidden
    B braveheartkenya

    I'm quite new to MFC programming ... how do i make it visible?

    C / C++ / MFC tutorial question

  • Message Box being hidden
    B braveheartkenya

    Hi all, I have some message boxes that are triggered from some buttons on a dialog. The dialog is set to open in full screen mode. The funny thing is that when the message boxes are triggered they get focus but they go behind my dialog. Any idea why this is happening and how to get the message box on top of the dialog? Thanks in advance.

    C / C++ / MFC tutorial question

  • CDialog and Keyboard events
    B braveheartkenya

    So how do i put the focus on the Dialog itself rather than on a control. The focus is currently on a button and i would like to put it on the dialog so that the events will be sent there.

    C / C++ / MFC c++ testing beta-testing help

  • CDialog and Keyboard events
    B braveheartkenya

    I have dialog (window/form) that inherits from the CDialog class. This dialog has various controls on it including a few buttons and textboxes. I am trying to get some keyboard events (key presses) to fire some events but its not working. In the Header file for the dialog i have this as a protected declaration [code] afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); [/code] I have an ON_WM_KEYDOWN() event created and its corresponding method in the .cpp file [code] void COpenGLMFCDlg::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) [/code] Within this method i have written some test code to change the text in a textbox just to see whether the event is fired correctly, but the text is never changed. I also tried changing the dialog's name and also firing some Message Boxes ... but nothing worked. The code in the "OnKeyDown" method is as follows: [code] void COpenGLMFCDlg::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags){ switch(nChar) { case VK_RETURN: SetWindowText("You pressed Enter"); break; case VK_F1: SetWindowText("Help is not available at the moment"); break; case VK_DELETE: //SetWindowText("Can't Delete This"); //AfxMessageBox("Testing"); m_Txt_Test.SetWindowText("The Event was fired"); break; case VK_DIVIDE: //SetWindowText("Testing"); m_Txt_Test.SetWindowText("Another Event fired"); break; default: SetWindowText("Whatever"); } } [/code] Could someone please (pretty please) tell me why this isn't working and whether i have done all that is needed for a keyboard event to fired & a result to be seen on screen. Thanks in advance.

    C / C++ / MFC c++ testing beta-testing help

  • Access SQL INSERT
    B braveheartkenya

    Thanks ... you were right ...i can't believe it was something so small

    Database help database tutorial question

  • Access SQL INSERT
    B braveheartkenya

    I'm new to SQL, so forgive my ignorance. I have a number of related tables. Of these there are 3 which are of concern to my problem: Invoices, InvoiceItems and Products. There is a 1:M r/ship between Invoices as well as between Products and Invoice items. The Invoice items table has InvoiceItemID, InvoiceID, ProductID, Quantity and Price. I would like to add 3 InvoiceItems as records in my InvoiceItems table and i would like to have them related to one Invoice (the last Invoice in my case) in the invoices table, that is, also the field in the InvoiceItems called InvoiceID for these 3 records should have the same InvoiceID. All the Primary Keys are set to AutoNumber. These are the the statements i used: INSERT INTO InvoiceItems ( InvoiceID, ProductID, Quantity, Price ) VALUES (4, 8, 1, 0); INSERT INTO InvoiceItems ( InvoiceID, ProductID, Quantity, Price ) VALUES (4, 9, 4, 0); INSERT INTO InvoiceItems ( InvoiceID, ProductID, Quantity, Price ) VALUES (4, 10, 2, 0); I would like to do this using some sort of INSERT SQL statements, but it's just not working. I can INSERT one InvoiceItem, but when i try to INSERT the next one i get some long error saying something about "type conversion failure","key violations", "lock violations" and "validation rule violations" Does anyone know why this is happening and how to correct it? Any help would be much appreciated.

    Database help database tutorial question

  • VC++ and DLL's
    B braveheartkenya

    I'm new to C++ so forgive my confusion. Could someone please give me an overview how to use a DLL in VC++. I got a DLL for a TreeView control with checkboxes from this site (QuickFilter.dll) for filtering some data but i don't know how to get the methods of the control. I can't even create the control. Please help me.

    C / C++ / MFC c++ help tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups