Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 22 Apr 2010
Offline Last Active Aug 24 2012 08:48 PM

#4970255 Moving from Direct3D to OpenGL

Posted by on 16 August 2012 - 11:32 AM

glClearColor states what color to use when you clear, so you should call it before glClear.

I would recommend having a look at Learning Modern 3D Graphics Programming. You can browse quickly through the parts you already understand, and quickly get to know how it is done the OpenGL way.

One problem is that Windows only support a very old API to OpenGL (1.1 or something like that), but the device drivers provides full support. To get access to the full functionality, you either have to use a special function to get the address of the extended functions, or you use a library that has it all prepared. I would recommend GLEW for this. I have heard gl3w is also good, but haven't used it myself.

If you want to write code that is compatible with Linux and other platforms, I would recommend glfw for a minimal library that provides an interface to windows management and other input and output devices. Stay away from GLUT.

thank you very much Posted Image

I'm using Qt 4 (QtOpenGL4.dll) what do you think? That has nothing to do? I program for windows and mac osx Posted Image

My project (lol)

#4966108 Problem in Render Lines

Posted by on 04 August 2012 - 08:51 AM

CreateWindowEx takes, as parameters, the window's bounding box dimensions. With a menu and a frame, the client area of the window (in which you commonly draw with D3D device) is significantly smaller.

You can use GetClientRect to determine the client area dimensions given a created window, or you can use AdjustWindowRect to find a suitable window size given a desired client size and window style.

Very thanks guy :)

it worked!!

RECT rect;
GetClientRect( hwnd , &rect );
    ZeroMemory(&d3dpp, sizeof(d3dpp));
    d3dpp.Windowed = !fullscreen;
    d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
    d3dpp.hDeviceWindow = hwnd;
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
    d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;
    d3dpp.BackBufferWidth = rect.right - rect.left; //screenWidth;
    d3dpp.BackBufferHeight = rect.bottom - rect.top; //screenHeight;


#4758374 New Forum FAQ

Posted by on 13 January 2011 - 11:54 AM

A tutorial teaching how to use the PIX with DirectX9.0 :)