• Content count

  • Joined

  • Last visited

Community Reputation

136 Neutral

About Marco81

  • Rank
  1. OpenGL 2D performance problem

    Issuing draw calls per quad can quickly become a CPU bottleneck, especially on older machines. Follow the advice of SimonForsman, focus on batching multiple quads that use the same texture in a single VBO. This should greatly improve your performance on older computers.
  2. My goal is to create a program that displays a skeletal based model, with the possibility to select individual bones and make them longer or shorter. This will be part of a character customization system. What I'm currently doing is applying a scaling matrix in bone space that scales the bone along the X axis (its length axis). This works, but also scales every bone connected to the scaled bones (which makes sense in a bone hierarchy). I need a method to cancel out the scaling for the connected bones. I tried applying the inverse of the scaling, but this seems to introduce skewing in the connected mesh. Does anybody know how to go about this, or knows about good resources dealing with this particular problem? Either my googling skills aren't that good or this is a technique that isn't being used often. Any help is greatly appreciated. Marco.
  3. AFAIK GLSL doesn't know that you haven't bound a texture to the sampler, causing it to use black as the texture color. A solution could be to use a different shader for single texturing. Alternatively if you want to use only 1 shader you can bind a small white texture (1x1) to GL_TEXTURE1 when you only have one regular texture.
  4. Quote:Original post by Tom KQT I just add two thoughts as addition to Marco's second post (not correcting him, just specifying): - Those two draw commands will be axactly the same, you don't need to sub-set your mesh any special way. - This simple solution will work also for "complex" meshes as long as they are convex. It won't work properly for concave meshes. Now the question is how "complex" a convex mesh can be :D Thanks that's exactly what I meant, but clearer ;-)
  5. My solution was as follows: -> Turn on front face culling -> Draw cube (this will always draw the inside of the cube) -> Turn on back face culling -> Draw cube (this will draw outside of the cube) However this solution is only suitable for relatively simple shapes such as cubes. If your meshes are more complex you need more advanced solutions to achieve correct transparent rendering. Using simple submeshes and sort them is possible, you can also look into more advanced techniques such as depth peeling. For more information: NVIDIA website
  6. In your transparency pass, render the back faces first (cull front faces) and render the front faces after that (cull back faces). If you just disable culling the render order depends on the order of the faces in the mesh (so sometimes it looks correct and sometimes it doesn't). Also you mention front2back, I assume you meant back-to-front for the transparency pass?
  7. OpenGL vs DirectX

    Both OpenGL and Direct3D are perfectly suited for your needs. Since you're targeting PC, you might need ask yourself if you really only want to target Windows. If there is a small possibility you ever want to provide your applications on Linux, you're probably better prepared using OpenGL. Otherwise it's a matter of taste and familiarity, nothing more. I've worked a decent amount of time with DirectX and recently started using OpenGL professionally. Here's my experience so far: Pros: - OpenGL is better suited for quickly hacking some test code using immediate mode - It will run on nearly every platform (Windows, Mac, Linux, mobile (OpenGL ES)) - Transition from HLSL to GLSL was painless Cons: - I hate the fact that parameters are not strongly typed (everything is GL(u)int). It's really easy to type GL_LINE instead of GL_LINES without the compiler catching it. Also IntelliSense is fairly useless if you get everything starting with GL_ not just the relevant ones. - Up to date reference documentation is hard to find. I really like the directx.chm help file from the DirectX SDK. I haven't found a decent alternative for OpenGL. (Yes, I've got the red & orange books on my desk :-) - I don't like it that the driver determines which version is supported. You need to make users update their drivers if you want to program for a specific OpenGL version. - It's hard to find development tools that are as well integrated and work as well as those provided in the DirectX SDK (PIX for example). (Although this is more a Linux issue) If I'm horribly wrong on any of these issues, please let me know.
  8. Quote:Original post by Juanxo Why he can't use glColor3f() before draw each cube? i think this way he don't need to use a vbo for colors and he just need to store a color for each cube, and he can sort cubes by color or something similar Because the glColor** functions are deprecated and are not available anymore in OpenGL core profile. To be future compatible it's better to use VBOs for everything.
  9. book !!

    You can download a digital version here. It's not free unfortunately.
  10. This extra console window

    In NetBeans go to project properties -> Run. For Console Type choose "Output Window". This way your output should appear in your IDE instead of in a separate console window.
  11. OpenGL Should I use GLUT

    You should have a look at freeglut.
  12. how to change png file?

    You are casting the color information, which is in RGBA (8 bits per pixel) to a D3DXVECTOR4 which consists of 4 32 bit floating point values. Each pixel is thus interpreted as a single float and I'm pretty sure that's not what you want.
  13. OpenGL freeglut/linux

    Strange, it should be working now. I cannot really draw any useful conclusion from your screenshot. A better test case would be a big rotating white triangle against a black background. You should definitely see the difference there (Aliasing issues are most noticeable on moving objects).
  14. OpenGL freeglut/linux

    What are the values of GL_SAMPLE_BUFFERS and GL_SAMPLES? GLint buffers(0); GLint samples(0); glGetIntegerv(GL_SAMPLE_BUFFERS, &buffers); glGetIntegerv(GL_SAMPLES, &samples); If GL_SAMPLES is greater than 1 you should be able to enable multisampling with glEnable(GL_MULTISAMPLE).
  15. Using fps to measure performance is not ideal, especially if you are trying to optimize rendering. Carefully timing the parts of the code you are trying to optimize is much better. Read more about it here (if you're interested ;-)