• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

102 Neutral

About ArgusMaker

  • Rank
  1. Hi there. I would like to optimize the double buffer rendering system I made in win32 c++ programming with gdi+. So far I created an offscreen static bitmap surface and a global Graphics object to draw onto it. The problem is, every time I want to update the HDC of my window i need to create a new Graphic object and destroy it at the end of the event, like this: ... case WM_PAINT: hdc = BeginPaint(hWnd,&ps); graphics = Graphics(hdc); graphics.DrawImage(backbuffer,0,0,width,height); EndPaint(hWnd,&ps); break; ... //graphics gets destroyed at the end of WndProc   Since this operation is repeated almost 40 times per second, i was wondering wether creating and destroying every time that object would somehow slow down my program. Maybe this solution would be better: - using a new compatible HDC as the backbuffer instead of the BMP - inside WM_PAINT, copy that with BitBlt instead of creating a Graphics object What do you think?
  2. OpenGL Vertex Colors?

    it works fine now, thanks!!
  3. Hi there! I'm programming in C++ - Win32 exe application environment. My exe makes use of OpenGL and glew, so it needs glew32.dll to be in System folder or in the same directory of my exe. What if i want to publish my exe without that additional DLL? Is there a way to include the DLL inside the EXE?
  4. Hi! I'm pretty new to OpenGL. I'd like to draw a line with a color gradient ranging from red to blue, but i can't give a color to my always-white vertices! I'm using a Vertex Buffer Object to render the line. This is my code. This is executed once at the beginning [CODE] GLuint VBuffer; GLuint CBuffer; GLfloat Vertices[] = { 0.0f,0.0f, //0,0 100.0f,100.0f, //100,100 2.0f,2.0f, 3.0f,3.0f }; // the line will be rendered using the first two vertices GLfloat Colors[] = { 1.0f,0.0f,0.0f,1.0f, //red 0.0f,0.0f,1.0f,1.0f, //blue 1.0f,0.0f,0.0f,1.0f, 1.0f,0.0f,0.0f,1.0f }; //the line will be rendered using the first two colors glGenBuffers(1,&VBuffer); glBindBuffer(GL_ARRAY_BUFFER,VBuffer); glBufferData(GL_ARRAY_BUFFER,sizeof(GLfloat)*8,Vertices,GL_DYNAMIC_DRAW); glGenBuffers(1,&CBuffer); glBindBuffer(GL_COLOR_BUFFER_BIT,CBuffer); glBufferData(GL_COLOR_BUFFER_BIT,sizeof(GLfloat)*16,Colors,GL_DYNAMIC_DRAW); [/CODE] When i render the line i use this code: [CODE] glBindBuffer(GL_ARRAY_BUFFER,VBuffer); glVertexPointer(2,GL_FLOAT,0,BUFFER_OFFSET(0)); glBindBuffer(GL_COLOR_BUFFER_BIT,CBuffer); glColorPointer(4,GL_FLOAT,0,BUFFER_OFFSET(0)); glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_COLOR_BUFFER_BIT); glDrawArrays(GL_LINES,0,2); glDisableClientState(GL_COLOR_BUFFER_BIT); glDisableClientState(GL_VERTEX_ARRAY);[/CODE] Yet the line is completely white. What is wrong?
  5. [spoiler] Hi there! I migrated from Direct3D to OpenGL a few days ago, i'm trying to obtain my first rendering. I already have a problem around using VBOs. [CODE]GLuint VertexBuffer; glGenBuffers(1,&VertexBuffer);[/CODE] Visual C++ generates this error: First-chance exception at 0x00000000 in myprogr.exe: 0xC00000005: Access violation execeuting location 0x00000000 within "glGenBuffers" line. The entire source is: [CODE] void InitOpenGL() { hDC = GetDC(GameWindow); PIXELFORMATDESCRIPTOR pfd; ZeroMemory(&pfd,sizeof(pfd)); pfd.nSize = sizeof(pfd); pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; pfd.nVersion = 1; pfd.iPixelType = PFD_TYPE_RGBA; pfd.cColorBits = 32; pfd.cDepthBits = 24; pfd.iLayerType = PFD_MAIN_PLANE; int pixelFormat = ChoosePixelFormat(hDC,&pfd); SetPixelFormat(hDC,pixelFormat,&pfd); hRC = wglCreateContext(hDC); wglMakeCurrent(hDC,hRC); GLuint VertexBuffer; glGenBuffers(1,&VertexBuffer); }[/CODE] InitOpenGL is called inside WinMain, just before the beginning of the main loop (while(1) {...} ) where windows messages are controlled and rendering is processed. I've already checked my OpenGL version (glGetString(GL_VERSION) returns "2.1.8395 Release") against OpenGL specifications and glGenBuffers should be supported..[/spoiler] edit: Never mind! I had to place glewInit() after the activation of OpenGL.
  6. [DX9]DeviceCheck

    Hi there. I have a variable with a pointer to my Direct3DDevice9 (IDirect3DDevice9* pd3dDevice) and i know my code may modify its value. How can i quickly test if pd3dDevice actually points to a valid device?
  7. [DX9 C++] HLSL in windows 64bit

    What do you mean?
  8. Hi there! I made an exe which loads an fx hsls shader effect file. It works properly as long as i execute it in windows 32bit, yet when i try in 64bit the effect file is no longer loaded. D3DXCreateEffectFromFile leaves my [color=#000000][font=Consolas, Courier, monospace][size=3]LPD3DXEFFECT NULL and does not return any of the following values: D3D_OK,[/size][/font][/color][color=#2A2A2A]D3DERR_INVALIDCALL, D3DXERR_INVALIDDATA, E_OUTOFMEMORY. Still the exe and the fx files are the same![/color] [color=#2A2A2A][img]http://public.gamedev.net//public/style_emoticons/default/wacko.png[/img] What's going on?[/color]
  9. Wavefront Obj format

    Ok, i forced sketchup to triangulate faces, now my importer works fine, thanks
  10. Wavefront Obj format

    Already tried with some obj models exported from sketchup. It doesen't work. I'm starting to believe sketchup doesent export obj well.
  11. Hello I want to develop an OBJ importer class in DirectX. I know there already is one created by microsoft but it simply doesen't satisfy me since i tried it with lots of obj models and barely two result correctly loaded. BUT there is still one thing about obj files that i don't understand. When a new line begins with 'f' it means that a list of vertices ID defining a face will follow, so i expect to find three IDs (eg: 1/1/1, 2/2/1, 3/3/1), instead, i find a variable number of indices, often greater than 3. The point is, how should i consider the vertex indices when they are more than 3? They are not supposed to be drawn with trianglestrip/fan/list method, i tried.
  12. Multi-Shading .. how to?

    Yes, but i had to guarantee up to 30 lights, and each pixel shader has a limited number of mathematical functions available. Thank you anyway
  13. Multi-Shading .. how to?

    Ok thank you, i'm understanding a little bit more about directx every day with such little questions. How useful is this forum!
  14. Multi-Shading .. how to?

    Tnaks! Useful as usual! It works fine, but.. could you please just explain me why you made me turn the zbuffer off?
  15. Multi-Shading .. how to?

    ok i wrote this to prepare the device to draw in blending mode, it still only shows the second light. Maybe I forgot something? [CODE] pd3dDevice->SetRenderState(D3DRS_ZWRITEENABLE,FALSE); pd3dDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_LESSEQUAL); pd3dDevice->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_ONE); pd3dDevice->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_ONE);[/CODE] Of course I restored the render states to the right values after rendering the second pass..
  • Advertisement