streamer

Members
  • Content count

    769
  • Joined

  • Last visited

Community Reputation

415 Neutral

About streamer

  • Rank
    Advanced Member
  1. Convert std::string to WCHAR ?

    This code is deeply broken. You're returning a pointer to memory that is freed when the function exits (because the temporary wstring will be destructed). It may seem to work, but that's the horrifying reality of undefined behavior - it often seems to work until it bites you viciously.   You are right! :)   +1 for noticing it.
  2. Convert std::string to WCHAR ?

    Here is one nice small snippet.  const wchar_t* to_wide( const std::string& strToConvert ) { return std::wstring( strToConvert.begin(), strToConvert.end() ).c_str(); }     Notice: not working, skip it. I just leave it as is, to be here as warning how NOT to do some things.
  3. Do you want to use 2D representation or real 3D isometric view? Both of approaches use different kind of programming.
  4. Geometry Shader Only Outputs 3 Vertices

    I am not familiar with geometry shaders but here are few thoughts: - you are using two triangles with unappropriated culling, switch culling off if there is a second triangle shown (easy to debug) - you are try to render triangles with triangle fan method, and output is expected to be two triangles. Add two more vertices, or render with triangle fan Anyway 3d APIs usually work with triangles not quads. However, OpenGL have GL_QUADS rendering method, but that is not geometry shader.
  5. I don't think there is any restriction about it (not 100% sure), probably the memory is the limit. However if I remember well, I have read somewhere that 3th dimension on texture also should be power of 2. So it is wise to have 1,2,4,8,16 etc layers.
  6. I am not familiar with SharpDX, but you are probably not using 3D textures out of box. 3D textures are made like bunch of 2d texture "slices", so if you have for example 10 pcs of 1024x1024 textures, you can make 1 3D textures with 10 layers of 1024x1024 textures. Then you make 1 SetTexture call and use 3 coordinates for mapping, instead of u and v coordinate for "ordinary" 2D textures.
  7. [quote name='addy914' timestamp='1341939612' post='4957660'] Thanks d k h, that story is really comforting to know. It tells me that spritesheets are the way to go for sure. I am wanting to support older graphic cards, so I am trying to pick a relatively low texture size that a lot of graphic cards will support. From what mhagain says, I should be safe with 1024x1024, which sounds good. Even if I were to use 4096x4096 or whatever texture size, I am wanting to answer the question "What if I exceed that size with my textures?" I am trying to think on a bigger scale(which in the game I'm making, I will certainly exceed 1024x1024 a few times). I could make another textures to hold this data but whenever I am in the rendering layer, I would most likely end up switching textures from the first page to the second page. As I slowly add on more and more "pages" of textures, the more I have to switch textures between them. Any ideas? [/quote] As I stated before 3D textures are way to go, if you are concerned about switching textures. If you feel any problem with 3D textures (yes they may not work on really old hardware) then your only way to go is to determine maximum texture size available on computer through caps, then dynamically create bigger texture sheet. Say you have 4 textures with 1024x1024 size and maximum available texture size on computer is 4096x4096, then you during loading process putt all 4 textures on one bigger. Of course you will need to have special class for handling UV of dynamically created textures but that is another story. But as mhagain stated probably you will not have too much problems with texture switching, biggest bottleneck you will probably have is a number of draw calls. Just try to make 4000 BeginSprite/DrawSprite/EndSprite calls then make same with 1 BeginSprite, 4000 DrawSprite and 1 EndSprite call,l and you will understand the problem.
  8. There is one "extended" version of using sprite sheets, and that is using of 3D textures. On programming side you have one texture call, with defining one more texture coordinate beside u and v. Probably this will be the fastes way.
  9. Best 3d modelling software for beginners?

    I recommend Cinama4d, it is really easy to use. Even I as programmer could made some basic stuff after 1-2 hours. As indie developer don't forget to check the price of modelling software. Cinema4D is pretty affordable if you are going to commercial software. And off course there is always a Blender - for free.
  10. DirectX :::Sprite using with 3d

    First of all you're probably drawing every charachter/number in between lot BeginSpprite/EndSprite calls. Use it only once. Second you can use DrawText. Check here. But the best thing you should use are Bitmap Fonts
  11. temp_rect.left = i_x; temp_rect.top = i_y; you're missing right and bottom values [smile]
  12. Thank you for reply [smile]
  13. Hello all, Say I have 300MB of texture loaded, and binded properly, so I have id for all textures. But my system have VRAM of 32MB, and I'm using 300MB textures. The quetsion is, what is happening in this scenario? Does OpenGL API constantly destroying old textures and moving new textures from system ram to VRAM as soon as new texture doesn't fit in VRAM? How does this affect system performance? And what if I use 1GB of textures on system that have only 768MB of system RAM? I didn't find any texture destroy functions in OpenGL [smile] is there any similar function? thanks in advance
  14. Quote:Original post by Brad789 If the textures is showing up upside down it is probably because in DirectX the coordinate 0,0 is at the top left of the image and in OpenGL the coordinate 0,0 is at the bottom left of the image. I haven't used DevIL since they were known as OpenIL so I can't help you much on the rest. If you can't find answers here you can also try the DevIL Help forum, they have a link to their forums on the DevIL home page on the right side. Thanks for your reply. I just flipped UV coordinates so it is not so big problem.
  15. Hi all, after some time I decided to move to OpenGL from DirectX, found DevIL for image manipulations, but seems that I cannot find some answers on net. These questions may seem trivial, but I'm a pretty new to OpenGL. First of all, if I load texture with DevIL and draw one rectangle, the UV coordinates seems tumbled up, like mirrored image. Probably I'm missing some parameter flag, because if I load it normally, the image is shown properly. What I'm missing? Also is this enough to load image? : ilInit(); ilutInit(); ilutRenderer( ILUT_OPENGL ); tex_id = ilutGLLoadImage( "cp.jpg" ); the texture is shown properly, but do I need: ILuint handle = ilGenImage(); ilBindImage( handle ); because is working without it. And last one, when I load texture with: ilLoadDataL( pData, lDataSize, width, height,16,16 ); how can I make OpenGL texture from it? thanks in advance