• Content count

  • Joined

  • Last visited

Community Reputation

512 Good

About hdxpete

  • Rank
  1. thanks for the advice. not sure what i will do yet.   i was really hoping that there was a cool casting trick i havent seen yet...
  2. hmm. that is really unfortunate. i really didn't want to redefine all methods that take ints to now take a union instead. i guess though it is better to bite the bullet...
  3. no not looking to use a union   basically i'm looking to know how i have to modifiy this code inorder for it to work as intended.   int x = 100; myRefData->data = x; int y = (int)myRefData->data;.
  4. Hello,   I am currently upgrading a game engine from a 32bit system to a 64 bit system. there are definate spots where the original author was holding a pointer in an int.    struct myrefdata {   int data; };   now i want to upgrade this to a 64 bit system. my initial idea was that this should be a void * instead of an int so   struct myrefdata {   void *data; };   now what i am finding is where the author did intend to actually hold an int in this field needs to be adjusted.   int x = 100; myRefData->data = x; int y = (int)myRefData->data;   while this example is a large oversimplication. i was wondering for those with more 64bit experience that me for assistance.   i am using c++11 on all my target platforms. how can i correctly convert a int to a void * and a void * to int, for the times i do want to hold an int in a void *?     another question...   assuming that there are other sections of the game engine where it is just impossible to convert that int to a void * but it does hold a pointer, is there a way i can force a memalloc in the 32bit space? or if i cant do that declare an array in global space of the program to hold the pointer and put this array in 32bit memory space.     very much appreciate any help anyone could provide.
  5. Wrong stride: glVertexAttribPointer

    your stride should be the same for all glVertexAttribPointer calls. i think you are mixing up the last 2 parameters.   1. is the sizeof(vertex) 2. offset from 0 to that data element in vertex.
  6. thank you kalle_h for the link   and thank you cgrant. this is the reason i asked for the specification. as we appear to be seeing some devices that are behaving slightly different. we resolved it by raising the precision however we would like to know if it is an implementation error on the driver or our part.   thanks again for the link kalle_h
  7. hello,    apologizes up front. my google-fuu is a complete failure today. i'm looking for information on the minimum sizes of lowp, mediump, and highp for opengl gl es 2.0.   if someone knows where to find this information i would be most grateful.   thank you
  8. DX11 Orthographic camera

    looks like you have your matrix multiplication reversed.   A * B * C != C * B * A   reverse the order.
  9. Optimising my renderer

    for(texture in textures)     for(sprite in sprites)       if(sprite.texture == texture)         list.append(sprite)       if(list.size > 0)       list.draw()     thats the basics. implementation is up to you
  10. Optimising my renderer

    •Minimize state changes and group the remaining state changes. How do you group state changes? - for example... changing the alpha blending.  •Use static vertex buffers where possible. How do you know if it is static? -i forget the flags but basically... can you write to it after it's created? then it isn't static Use one large static vertex buffer per FVF for static objects, rather than one per object. What if each object has the same vertex property? Eg. all objects are 256 x 256 quads? reuse the same buffer? - i create 2-3 pools. switch pools every frame. hopefully reduces lag to gpu •If your application needs random access into the vertex buffer in AGP memory, choose a vertex format size that is a multiple of 32 bytes. Otherwise, select the smallest appropriate format. Random access as in needing to change vertexes at runtime? - data = vb->lock(); data +13 = x; vb->unlock();   lock/unlock as minimally as possible. write to a locked buffer as minimially as possible.   one thing i noticed is you are doing 1 draw call per sprite. group sprites by texture to reduce draw calls. you may have 10k sprites but do you have 10k textures? maybe you have 10k sprites but they are on 2 textures. you don't need 10k draw calls. you can do it in 2.
  11. while the actual calculation of three matrixs M * V * P may take a shorter amount of time on the GPU then the CPU. typically the CPU is a frame or two ahead of the GPU anyway. Also moving any calculations from the gpu to c++ with make your shaders faster meaning you can draw more pixels per second meaning you have a higher fps.   for shaders i follow the KISS method.
  12. OpenGL Problem loading texture O

    maybe not the cause of your issue however border is an int not a float.   void glTexImage2D( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid * data);  
  13. D3D11_USAGE for a vertex buffer

    I can't answer questions about speed. however i created a method to wrap the DX calls away from me. and i put a boolean flag to indicate that the VBO contents will change each frame.   so if it is never changed i create with usage IMMUTABLE and CPUAccessFlag 0 if it is changed i create with usage DYNAMIC and CPUAccessFlag CPU_ACCESS_WRITE   YMMV
  14. i do 99% of my work in GL ES. but the 3rd and 7th parameter on GL ES have to match. it could cause color issues for you if they don't in normal GL desktop
  15. glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, data);