Jump to content
  • Advertisement

FireInDark

Member
  • Content Count

    38
  • Joined

  • Last visited

Community Reputation

148 Neutral

About FireInDark

  • Rank
    Member
  1. FireInDark

    Freetype/GL/VBO/shaders

    great job
  2. [attachment=10653:???.jpg] Now ,I render text with FreeType and it goes well . At last I got the RBGA data like this: for(int h = 0;h < bitmap_height;h++) { for(int w = 0;w < bitmap_width; w++) { paper_buffer[((pen_y + h) * paper_width + pen_x + w + char_advance)*4 + 0] = buffer[bitmap_width * h + w] * color[0] / 256; paper_buffer[((pen_y + h) * paper_width + pen_x + w + char_advance)*4 + 1] = buffer[bitmap_width * h + w] * color[1] / 256; paper_buffer[((pen_y + h) * paper_width + pen_x + w + char_advance)*4 + 2] = buffer[bitmap_width * h + w] * color[2] / 256; if( buffer[bitmap_width * h + w] == 0) paper_buffer[((pen_y + h) * paper_width + pen_x + w + char_advance)*4 + 3] = 0;//if the gray data is zero set the alpha be zero else paper_buffer[((pen_y + h) * paper_width + pen_x + w + char_advance)*4 + 3] = 255; } } paper_buffer save the RGBA data and buffer means the gray data in FT_Bitmap . And I send the RGBA data to GPU as a texture. And I code GLSL like this: "void main() { gl_TexCoord[0] = gl_MultiTexCoord0; gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * gl_Vertex; }" "uniform sampler2D normal_tex; uniform sampler2D text_tex; void main() { vec4 text_color; vec4 normal_color; normal_color = texture2D(normal_tex,gl_TexCoord[0].st); text_color = texture2D(text_tex, gl_TexCoord[0].st); if(text_color.w == 0) gl_FragColor = normal_color * 0.8 + text_color * 0.2; else gl_FragColor = text_color * 0.8 + normal_color * 0.2; } so the result is the image above..seems not so smooth . And I want to know how do you do when you do this thing?
  3. Maybe I understand now ,let me have a try. Thank you very much.
  4. It is this: There are two elemets A and B . 1.We render A to the Frame Buffer - yes then the Frame Buffer contains pixel of A , some pixels's alpha are zero and some are not.. 2.We render B to the Frame Buffer - and how ever - if the alpha in Frame Buffer is zero ,the pixels at the same position(2D) of B will be draw to the FrameBuffer else not. May be we can use stencil values but there are some reason I don't want to do like this. Any way ?
  5. No I don't use the datas in CPU but GPU -GLSL I need control if the right pixel of an element such as a triangle will be draw to the frame buffer.
  6. Yes I render text with FreeType and it's goes well . [attachment=10597:???.jpg] Yes seems every thing all right.. But see here: view.setFontColor(255,255,255,255); Yes I do want to set the font_color be white,but it show me the black text.. It's quite sure that the color of the pixels rendered by FreeType are all right: for(int h = 0;h < bitmap_height;h++) { for(int w = 0;w < bitmap_width; w++) { paper_buffer[((pen_y + h) * paper_width + pen_x + w + char_advance)*4 + 0] = buffer[bitmap_width * h + w] * color[0] / 256; paper_buffer[((pen_y + h) * paper_width + pen_x + w + char_advance)*4 + 1] = buffer[bitmap_width * h + w] * color[1] / 256; paper_buffer[((pen_y + h) * paper_width + pen_x + w + char_advance)*4 + 2] = buffer[bitmap_width * h + w] * color[2] / 256; paper_buffer[((pen_y + h) * paper_width + pen_x + w + char_advance)*4 + 3] = 255; } } and when : glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);//first texture glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD); //text texture view.setFontColor(255,255,255,255); [attachment=10598:???.jpg] seems well. but then: view.setFontColor(255,0,0,255); [attachment=10599:???.jpg] yes ,it's red but not pure red one.. then what I want to do is see the text color as what I set. there must be the reason of glTexEnvi
  7. Think about that : If copy the datas to a texture with glCopyTexImage2D every time an element rendered ,wouldn't it'll take a long time?
  8. And that :if I can visit the datas from Frame Buffer there would be no problem.. But seems it's not possible..
  9. No ,it's just a common texture. To be honest ,What I want to do is blending all the objects rendered by it's depth ,stencil ,alpha and some thing else. my self. I got a way to do what I want to do ,But there are extra works to do ,not so directly ..
  10. A FBO connect with a RenderTexture ,depth buffer,and other buffers.. Now I create a new Texture ,I want to copy the data from depth buffer to this texture. Any way ?
  11. FireInDark

    About MRT

    Thank you very much ,I'll try it.
  12. FireInDark

    About MRT

    Seems it the right way .But wouldn't it be slowly ? If the elments are in a "Tree" it'll take many times to change the target ..
  13. FireInDark

    About MRT

    Think about that ,in case MRT,we have two render target (All are textures ): texture A and texture B. Now the first element has been rendered ,texture A save the image and texture B save other datas.. then wen need to render another element ,but here , I need the datas in texture B to juge if the right pixel should be wirte or not..and the same time ,I also need to write texture B in some case when rendering the second element; Any way ? if i just bind the texture B as the GL_TEXTURE1 or GL_TEXTURE2 or somthing..
  14. FireInDark

    Question about GLEW.

    To be honest ,I done it like this... But it's such a rolling ..I'm rolling in the deep..
  15. I use GLEW on MS-Windows. It's helpful and do many works .. But ,till now,I can't find a way to init GLEW without creating a HGLRC and it also means I should create a window first.. Without the help of GLEW I can't use the the new functions newer than OpenGL 1.1 on MS-Windows such a glGenBuffers or others.. But I really don't want to create a window before I render to the FBOs,any way ? May be we can find the functions from the driver's dll file of display card but I thinks it's not a right way to me..
  • 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!