• Content count

  • Joined

  • Last visited

Community Reputation

123 Neutral

About wlb2001

  • Rank
  1. Hi there: These days I am trying to move my project from WinXP32 to WIn7 64bit. Well, it's crushed. The first problem I have found is VBO. If I use VA, it works fine, but VBO not. It shows memory error when calling glDrawElements(). So anybody have any idea? PS: I am using Vs2005 32bit. will it be the problem? should I use vs2010 64bit instead of vs2005? Thanks for your help!
  2. Terrain multitexturing problem

    [quote name='phantom' timestamp='1317512060' post='4868115'] These days I'd be very suprised if you had to go below 'DX9 level' hardware, which is basically shaders; I have a hard time imagining there are much hardware 'in the wild' these days which wouldn't support GLSL1.0, and that which didn't probably wouldn't have the fill rate to pull of other hacks or multi-pass tricks at an acceptable speed anyway. I'd advise that, unless you know for certain a large percentage of your target can't run even basic shaders, to go in the shader direction. If you are doing it 'just to learn' then stop right now. The API is dead, there is nothing to learn which would be useful and you would be better served picking up shaders instead. [/quote] Yeah, I am sure most of my targets can't run shaders. I hate those on board video chips. Most of them only support up to OpenGL v1.4(maybe 1.5).That's why I have to figure out the way without shader. Anyway, still really thanks for the advices.
  3. Terrain multitexturing problem

    [quote name='Murdocki' timestamp='1317503455' post='4868082'] If you got four images of 256*256 dimensions you can create one image of 512*512 which contains one of the images in each corner, you can do this with paint / gimp or any other image editing tool. Something like this: [img]http://www.echo-gaming.eu/base1.png[/img] This image is then loaded and bound as a single texture, in your fragment program you can calculate the texture coordinates for each individual image with something like this [code] vec2 t1Coords = vec2( texCoord.x / 2.0, texCoord.y / 2.0 ); vec2 t2Coords = vec2( texCoord.x / 2.0 + 0.5, texCoord.y / 2.0 ); vec2 t3Coords = vec2( texCoord.x / 2.0, texCoord.y / 2.0 - 0.5 ); vec2 t4Coords = vec2( texCoord.x / 2.0 + 0.5, texCoord.y / 2.0 - 0.5 );[/code] [/quote] Okya. It sounds works.I'd try it later. Really thanks for the idea.
  4. Terrain multitexturing problem

    [quote name='Murdocki' timestamp='1317485809' post='4868003'] A2: Texture atlassing is key, just put the four textures into one and sample it four times( once for each detail channel ) [/quote] Thanks for the reply Murdocki; would you give any details for putting 4 textures into one? I really have no idea how to put four textures into one (each texture at least has 3 channels RGB,and for enable textures I have to call glActiveTexture() 4 times.).
  5. Terrain multitexturing problem

    [quote name='JTippetts' timestamp='1317476379' post='4867963'] To the best of my knowledge, what you are trying to do isn't really possible using fixed-function alone, and especially not in a single pass. I remember implementing something similar a very long time ago using glVertexAttribPointerARB to specify an array of vertex attributes per blend layer to perform the blending, but even still I had to set up a vertex program (old school) to do the alpha replacement. Maybe you could figure something out if you split the blending RGBA texture up into separate GL_ALPHA format textures, but this of course would eat up available binding slots. [/quote] Really thanks for the help. Is it could be done by multipass? Use depth function to set equal for second pass?
  6. Hi there: I am currently working on a terrain rendering project. I have 2 problems with it. 1: The terrain has 4 textures for multi-textureing(grass,sand,rock ....), and also has a 4 channels(RGBA) detail texture to indicate weight of each texture.(ie.128,0,127,0 roughly means %50 grass and %50rock). By using shader, this is easy, final = a*R + b *G + c*B + d*A where a,b,c,d are sample color from textures.But how to implement it without shader? For example, we might use glTexEnv for multitextureing? Is that possible to render it without shader and in single pass? 2: if terrain textures are up to 8, then it will be 10 texture units(8 textures,2 details) it seems it is impossible to render it within single pass even if with shader.(because most video cards only support 8 texture units for multitextureing) Is there any way to render it in single pass? thanks for your helps!
  7. FBO MRT and multisampling

    Really thanks for replys, and I learn a lot. According to the answers, it seems that it isn't possible to get downsampled(and also multisampled) secen image in one path. Then only 2 choicese left. 1. gen a MS supported FBO with full screen size, blit to an equal size texture bind fbo, then generate 4 fbos and render quads for each one to get downsampled images. 2. almost same as above, but just use blit to get 4 texture binded fbos. Which one should be faster?, because I have tried it on my project, I didn't see much FPS diffrence. Btw, is there any other faster way to do this? Tanks for your helps!
  8. Hi there: I have 2 problem with fbo; 1: I bound 4 textures to 1 fbo with glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, GL_TEXTURE_2D, m_fbo.tId[i], 0); 4 textures are diffrent size. 512 * 512, 256 * 256, 128 * 128 and 64 * 64 after I rendered secen,only the smallest size texture is correct, and all the others only update part of image(which equal to 64 * 64 at lower- left corner),is that means FBO MRT doesn't support different target size? 2: I created 2 fbos, one use glRenderbufferStorageMultisample to get multisampling working,and after rendered secen, i use glBlitFramebufferEXT(0, 0,w1, h1, 0, 0, w2, h2, GL_COLOR_BUFFER_BIT, GL_NEAREST) to render fbo1 to fbo2's texture; if w1 == w2 && h1 == h2, witch means fbo2's size same as fbo1's render storage, it works ,otherwise i get a black image. so my quesstion is : does it have to be same size when blit from a multisampled fbo to other texture binded fbo? Thanks for your helps
  9. OpenGL Opengl vsync

    Yeah, I know wglSwapInterval works.I just worndering how to do this by direct draw,and the artical says by using directdraw you get the extra benifit which is to support "true" full screen.(which probably means the difference between opengl and d3d when you press alt+tab) Anyway the artical isn't in english, that's why i do not post the link.
  10. Hi: Yesterday I have read an artical about how to implement vsync by DirectDraw,even use the opengl for rendering api. I was wandering is that possible? #include <ddraw.h> #pragma comment(lib,"ddraw.lib") //before create opengl render context HRESULT hr = DirectDrawCreateEx(NULL, (VOID**)&m_pDD, IID_IDirectDraw7, NULL); DDSURFACEDESC2 ddsd; DDSCAPS2 ddscaps; m_pDD->SetCooperativeLevel(m_hWnd, DDSCL_NORMAL ); memset(&ddsd, 0, sizeof(ddsd)); // Set all fields of struct to 0 and set .dwSize to ddsd.dwSize = sizeof(ddsd); // Sizeof the variable - these two steps required for most DDraw structs ddsd.dwFlags = DDSD_CAPS; // Set flags for variables we're using... ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; // Set the variables we said we would in dwFlags hr = m_pDD->CreateSurface(&ddsd, &m_pDDSPrimary, NULL); //on draw m_pDD->WaitForVerticalBlank( DDWAITVB_BLOCKBEGIN, NULL); SwapBuffers( m_hdc ); //on destroy if( m_pDDSPrimary ) m_pDDSPrimary->Release(); m_pDDSPrimary = NULL; if( m_pDD ) m_pDD->Release(); m_pDD = NULL; Anyway I have tried and faild, Does I miss something or it's just not possible? Thanks for your help!
  11. Hi Guys: I am looking for a really fast solustion for Ray Triangle Intersection in 2D space. 1. A point P(xp,yp), and a Vecter Dir(xd,yd) 2. Three points T1,T2,T3 constructed a triangle. 3. The point P must be in the triangle, witch means the ray cast from inside of the triangle to the outside (or maybe cast alone one edge of the triangle). I don't think the ray-line intersection detection will be the fastest way to do this, anyone have any ideas? PS: small issue. for example: If the P = T1 and the Dir = T2 - T1 then the intersection point should be T2(not any points on the T12 EDGE), and the intersection EDGE should be T23,(not the T12). Thanks for your help.
  12. Really thanks for the help! I do forget to set the alpha bits when i set the pixelformat. Now I got the right result. But the problem is, I still didn't get an transparent background, even the alpha value in framebuffer is 0. So what can I do now?
  13. Hi there! I am trying to implement a desktop 3d model viwer, which means I don't want to show the anything about window, just a 3d model itself.(windows plateform). I have tried SetLayeredWindowAttributes(), but that function not only make the window transparency but also make everyting draw in the framebuff transparency. And that method really decreases the FPS. By the way, there is anther problem confused me. glClearColor(0,0,0,0); unsigned char _Tbuf[40000]; unsigned char _Tbuf2[40000]; memset(_Tbuf2,0,40000*sizeof(unsigned char)); glDrawBuffer(GL_BACK); glDrawPixels(100,100,GL_RGBA,GL_UNSIGNED_BYTE,_Tbuf2); glReadBuffer(GL_BACK); glReadPixels(0,0,100,100,GL_RGBA,GL_UNSIGNED_BYTE,_Tbuf); the _Tbuf alpha channle always be 255, no matter what alpha value I set. Is that means the framebuff alpha channle is always 255? Thanks.
  14. Font weight?

    Hi Guys: Does anybody have any idea about FreeType2? The text output by Freetype2 looks too "thin" at sometimes, specially when I am pringting small size text.I was trying to set the "Weight" for the text, but how? how can I set font weight by using FreeType2? (Like wingdi provides CreateFont has a "Weight" param). thanks for your help. PS: also the FT_Set_Pixel_Sizes really doesn't set a "fixed text height" for me, which means if I set the font height to 16 pixels, after I convert the Glyph to bitmap, the bitmap rows could be greater then 16 pixels, how can I get a fixed height Glyph?
  15. Thanks for the reply. I have read that page, but I didn't find the answer.