• Content count

  • Joined

  • Last visited

Community Reputation

124 Neutral

About 3dmaniac

  • Rank
  1. Hello All, i've been playing around with opengl for some period of time and now i'd like to start using directx. The thing im wondering at is the lost device state that wasn't present in opengl...should i respond this state and, if so, what is the common way to do this? If my understanding is right, it requires recreating almost all video resources that resides in default pool, so it could be a bit of complicated as you need to reload all textures, recreate buffers, reinitialize the renderer...lot to do for a game engine....? Thanks in advance :)
  2. OpenGL OpenGL cards

    go buy 7950, ive got x1950 and i know i made a mistake...ati doesnt really bother about opengl compatibility
  3. Works perfect in VC6 but hell not in vc2005...i've got no idea whats' going on edit. WNDCLASS wc; h_Instance = GetModuleHandle(NULL); wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; wc.lpfnWndProc = (WNDPROC)WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = h_Instance; wc.hIcon = LoadIcon(NULL, IDI_WINLOGO); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = NULL; wc.lpszMenuName = NULL; wc.lpszClassName = L"Window"; // THIS if (!RegisterClass(&wc)) { return false; } dwExstyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE; dwstyle = WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN; h_Wnd = CreateWindowEx( dwExstyle, L"SomeWindow", // and THIS should be the same L"Some title", dwstyle, 0, 0, 640, 480, 0, 0, h_Instance, NULL ); Thanks people, i used GetLastError and i got error 1407 (cant find window class), class names were different. Thanks a lot. [Edited by - 3dmaniac on October 12, 2007 8:53:41 AM]
  4. Selecting lines with a mouse

    did you consider opengl build-in picking method using names? or on your own, you need to find ray pointing from cam position through cursor(probably using gluUnproject?) and find the closest distance between this ray and line you're picking, but this is a mathematical issue...
  5. OpenGL Scene creation help

    here you got http://www.gamedev.net/reference/ ;) know its lots of digging but you need to meet some basics and theory before you start your adventure with opengl and graphics in general ;)
  6. Circle in fragment shader

    switch to rendering to rexture, then x^2 + y^2 = r^2 //pitagoras says so isnt it simple ? :) about squares with rounded corners: you can find source of some graphic library for c, but as i remind the algorithm is rather complex, though
  7. Shader basics

    heh actually fragment shader is executed as many times as many fragments is being processed for a scene, so if you got lots of overdraw and its not handled by early-z rejecting then shader is executed many times for a single pixel of a screen(and this is why we are using pre-z pass and near to far drawing order). The curious question is what 'fragment' actually mean? ;)
  8. gl_NormalMatrix in GLSL

    if you want the side in front of camera to be always blue try this gl_FragColor.rgb = gl_NormalMatrix * norm;
  9. discard in GLSL

    think you need to describe your problem more precisely...
  10. How to set zFar?

    From Depth_In-Depth ati guide: "One of the issues in changing existing code rendering the skybox first to rendering it last is that the box will usually get clipped in the corners by the far clipping plane and/or by previously-rendered geometry. This may happen because the skybox is modeled by an artist and has a fixed size, but even a programmer generated skybox may see issues like this. Instead of pushing the far clipping plane back a solution to these issues is to leave the far clipping plane untouched and instead simply peg the depth of the skybox to the far clipping plane. There are different methods to achieve this. The perspective divide produces a depth value of z / w, and the far clipping plane is always at depth 1.0, so one method to peg an object to the far plane would be to arrange for z to be equal to w. This can be done in a vertex shader by simply assigning w to z after transformation as the following code fragment shows: // Out.position = mul(mvp, vertex); Out.position = mul(mvp, vertex).xyww; The only change necessary is to add the .xyww swizzle in the end. As a bonus, this compiles down to just three instructions instead of four."
  11. OpenGL Blank Screen (strange....)

    think this is the problem: glClearDepth(0.0); set it to 1.0 and then it should work ;] also try to push your quad ahead so that it fits in the view volume this gluPerspective(45.0f, width/height, 10.0f, 10000.0f); may cause bitter z-fighting effect(unless you're using 24bit depth), why don't you set the far clipping plane somewhere closer? hope this will help regards
  12. encapsulating window

    thank you, this helps
  13. Hello there, i'd like to encapsulate a main window for game in a class, lets say CGameMainWindow(working with VC++). But i cant set the WndProc method for window class, it is wc.WndProc = (WNDPROC)WndProc or something like this. Compiler says that there is no possible conversion so the value cant be assigned. when not in a class, it works..looks to be a problem with calling convention thiscall vs stdcall... or something...know its a lame question but i just would like to know how to accomplish that if possible
  14. Hi, I think it should be enough to switch to ortho, set filtering to POINT and then draw texture sized rectangle to achieve what you want. If you want to sample neighboring texel, you must offset texcoord by 1/textureWidth or 1/textureHeight as the texcoords are normalized. Hope it help
  15. Changing colour of texture

    Hello there, you can use these functions controlling data transfer before texture creation glPixelTransferf(GL_RED_SCALE, 0.5); glPixelTransferf(GL_BLUE_BIAS, 0.5); these provide only very limited control but its allways better than nothing...