Jump to content
  • Advertisement

The Lion King

Member
  • Content Count

    313
  • Joined

  • Last visited

Community Reputation

115 Neutral

About The Lion King

  • Rank
    Member
  1. Hello, Please sign me up as well. -- Syed
  2. The Lion King

    Lesson 02: Code Optimization - Strange Errors

    ARGH! Sorry! I figured it out. The problem was in the array decleration :( After working with so many languages at the same time, got confused and wrote sLine Line [2]; which declares 2 not 3 ... thus a stupid error. Sorry ... problem solved :)
  3. The Lion King

    fullscreen to windowed focus issue

    Should be able to help you out if you put the code. But you should try using D3DPRESENT_PARAMETERS. Use SDK for some detail help. Here is the code of my DX Engine ReSet function: void cGraphics::ReSet (bool FullScreen, // Flag for Full Screen Mode int Width, // Width of the Window int Height) // Height of the Window { // If Full Screen is true, then if (FullScreen) { PresentParameters.Windowed = false; // FullScreen Mode PresentParameters.FullScreen_RefreshRateInHz = RefreshRate; // Screen Refresh Rate } // Else, if Full Screen is false, then else { PresentParameters.Windowed = true; // Windowed screen Mode PresentParameters.FullScreen_RefreshRateInHz = 0; // Default Screen Refresh Rate } PresentParameters.BackBufferWidth = Width; // Width of the Window PresentParameters.BackBufferHeight = Height; // Height of the Window Data.GFXDevice->Reset (&PresentParameters); // Re-Set Direct3D9 Graphics Device DefaultSettings (); // Set Default Settings for the Graphics }
  4. Thought I should restart OpenGL again and tried converting NeHe lessons into some sort of reusable classes form or functions. I have read several OOP implementation conversations of NeHe code, but this ain't what this post is about. But might be something that I have missed somewhere [looksaround]. I have implemented the rendering functions for Triangles and Quads in a little class form and using them in my application. When I use these, I get very strange errors that are hard to describe. Shape of Triangle is very odd, Quad is having different vertices's or runtime errors when closing application [disturbed]. However, I tried NeHe implementation of Lesson 02 and implemented the rendering calls in the Render function everything worked fine as it should be. But when I started using my designed classes, I got strange errors again. If I use only one Triangle or Quad, it works fine. Using multi versions, or using both gives very strange errors as explained above. Here is the code of my designed header file for Shapes: // Line Structure struct sLine { float x; // Position on X - Axis float y; // Position on Y - Axis float z; // Position on Z - Axis }; // Class Triangle class cTriangle { public: // Members that can be accessed by anyone sLine Line [2]; // Array of Lines void Render (void); // Render Triangle }; // Class Quad class cQuad { public: // Members that can be accessed by anyone sLine Line [3]; // Array of Lines void Render (void); // Render Quad }; The code used to represent the Render function of both Triangle and Quad class: void cTriangle::Render (void) { glBegin (GL_TRIANGLES); // Begin Drawing glVertex3f (Line[0].x, Line[0].y, Line[0].z); // Draw Line 01 glVertex3f (Line[1].x, Line[1].y, Line[1].z); // Draw Line 02 glVertex3f (Line[2].x, Line[2].y, Line[2].z); // Draw Line 03 glEnd (); // End Drawing } void cQuad::Render (void) { glBegin (GL_QUADS); // Begin Drawing glVertex3f (Line[0].x, Line[0].y, Line[0].z); // Draw Line 01 glVertex3f (Line[1].x, Line[1].y, Line[1].z); // Draw Line 02 glVertex3f (Line[2].x, Line[2].y, Line[2].z); // Draw Line 03 glVertex3f (Line[3].x, Line[3].y, Line[3].z); // Draw Line 04 glEnd (); // End Drawing } This is how I setup the vertices's for Triangle and Quad classes: Triangle.Line[0].x = 0.0f; Triangle.Line[0].y = 1.0f; Triangle.Line[0].z = 0.0f; Triangle.Line[1].x =-1.0f; Triangle.Line[1].y =-1.0f; Triangle.Line[1].z = 0.0f; Triangle.Line[2].x = 1.0f; Triangle.Line[2].y =-1.0f; Triangle.Line[2].z = 0.0f; Quad.Line[0].x =-1.0f; Quad.Line[0].y = 1.0f; Quad.Line[0].z = 0.0f; Quad.Line[1].x = 1.0f; Quad.Line[1].y = 1.0f; Quad.Line[1].z = 0.0f; Quad.Line[2].x = 1.0f; Quad.Line[2].y =-1.0f; Quad.Line[2].z = 0.0f; Quad.Line[3].x =-1.0f; Quad.Line[3].y =-1.0f; Quad.Line[3].z = 0.0f; And this is how I use them in Render functions: int cGame::RenderScene (void) { // Clear Color and Depth Buffer glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity (); // Reset Current Model View Matrix glTranslatef (-1.5f, 0.0f,-6.0f); // Move Pointer // Drawing Triangle Triangle.Render (); glTranslatef ( 3.0f, 0.0f, 0.0f); // Move Pointer // Drawing Quad Quad.Render (); return true; // Scene Rendered Successfully } My observations: - If I do not use Quad and only use Triangle it works fine. - If I use another Triangle class, strange errors appear. - Even if I comment out the render function of quad in the above example and only use the quad class for setting up vertices, the error remains ... [crying] Can't figure out what is wrong. But of course, if instead of using this class, I just use them plainly in the render function like this, it works fine: int cGame::RenderScene (void) { // Clear Color and Depth Buffer glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity (); // Reset Current Model View Matrix glTranslatef (-1.5f, 0.0f,-6.0f); // Move Pointer // Drawing Triangle glBegin (GL_TRIANGLES); // Begin Drawing glVertex3f ( 0.0f, 1.0f, 0.0f); // Draw Line 01 glVertex3f (-1.0f,-1.0f, 0.0f); // Draw Line 02 glVertex3f ( 1.0f,-1.0f, 0.0f); // Draw Line 03 glEnd (); // End Drawing glTranslatef ( 3.0f, 0.0f, 0.0f); // Move Pointer // Drawing Quad glBegin (GL_QUADS); // Begin Drawing glVertex3f (-1.0f, 1.0f, 0.0f); // Draw Line 01 glVertex3f ( 1.0f, 1.0f, 0.0f); // Draw Line 02 glVertex3f ( 1.0f,-1.0f, 0.0f); // Draw Line 03 glVertex3f (-1.0f,-1.0f, 0.0f); // Draw Line 04 glEnd (); // End Drawing return true; // Scene Rendered Successfully } Any help or information on this would be really appreciated. I believe this has something to do with OpenGL not with the classes. But I can be wrong ... Regards, Syed
  5. The Lion King

    Prevent a window from moving - fixed

    I believe this problem cannot be solved by the message handler :) If you wish to just stop user from moving the window. Try playing with the CreateWindowEx() function and its flags :) That should do the trick ... If you still can't figure it out ... let me know and I will post the code
  6. The Lion King

    audio guy looking into programming

    First of all, learn C/C++ Then simply switch to and start practicing any one of the below: - FMod - Audegie - OpenAL
  7. The Lion King

    Pictures in Dialog Boxes

    Quote:Original post by Cybrosys I'm sorry but i don't know, however i would suggest that if you are serious about writing a win32 app i'm going to suggest that you take a look at C#. I've tried to use and learn win32 api programming but microsoft/msdn doesn't support help in that area any more. They created MFC to help with win32 programming but as far as i've tried it and heard from other people it wasn't that successful, i might be wrong. After MFC came C++ Managed and C#. C++M pretty much tries to offer what C# offers but is somewhat complicated? Well as i said, if you're serious about writing win32 code install C#, it'll just make you smile =) ( I think you need to grab the WM_PAINT from/for the button and override it's hdc with some own graphics, or something of the sort? ) OK! If you say C# is good. Is it easy to learn for a C++ propgrammer. I need to create an application fast :( between thanks for the tip ;)
  8. I am trying to have a Pitcture and a Button with Picture on Dialog Box using Win32 and Visual C++. Problem is when i create picture and button controls ... their properties does not contain anything relating to displaying image. Can anyone help me out. Is this accomplishable through Dialog Box or not or will have to do it all manually?
  9. The Lion King

    MS Access and C++

    Quote:Original post by technomancer if you don't mind using MFC then the DAO classes are available that can read and write to Access DB's I would prefer using Non-MFC
  10. The Lion King

    MS Access and C++

    Quote:Original post by jeroenb Take a look at the ODBC functions. They make it pretty easy to control your database via C++. On our nwnx website in the downloads section you can download a copy with sources of the nwnx_odbc plugin. It contains all code to connect to a few different databases. Thanks ... anyone else with any other stuff.
  11. The Lion King

    MS Access and C++

    How can I use Microsoft Access Database in C++? I mean I need to edit and change and add data stuff for MS Access database file (*.mdb) ... just like SQL ... any links or tutorials :)
  12. The Lion King

    Skinning Win32 Application

    Quote:Original post by IaM Take a look at this: http://www.codeproject.com/useritems/SkinCtrl.asp It allows you to skin the Win32 controls in any application. It seems to be specifically for WinXP only. What if anyone run my apps in Win98 or Win2K ... and it still has some bugs. Anyway ... I can follow that example :) Any more ?
  13. The Lion King

    Skinning Win32 Application

    Quote:Original post by tnan Here's a nice introduction http://www.flipcode.com/articles/article_win32skins.shtml /.tnan Thanks but thats the first one on my list :( Anything else :!
  14. Hi, Can anyone point out to any links or tutorials to how to skin an application using Win32 and C++ (no MFC). Even commercial or free libraries would do. I have been searching for a while and found only a few. I need to know if there are any more or just limited stuff is available. Thanks,
  15. The Lion King

    Playing Video Files

    Thanks guys ... I think I have to use Quick Time and Real Player SDKs for such stuff. Thanks,
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!