Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 26 Oct 2011
Offline Last Active Feb 10 2015 02:02 AM

#5195633 C++ 64 bit void */int conversion addressing questions

Posted by on 01 December 2014 - 12:36 AM



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.

#5147780 Optimising my renderer

Posted by on 17 April 2014 - 07:39 PM

for(texture in textures)

    for(sprite in sprites)

      if(sprite.texture == texture)



    if(list.size > 0)




thats the basics. implementation is up to you

#5147589 Optimising my renderer

Posted by on 17 April 2014 - 03:07 AM

•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.

#5117751 Trying to load 16 bits texture only show in black and white...

Posted by on 18 December 2013 - 12:06 AM

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, data);

#5103282 Vertex and Index Buffer Locking

Posted by on 21 October 2013 - 08:41 PM

what i do is create a number of dynamic VBO equal to the swap frame count. so if im double buffered i create 2. frame A i write to 0 and frame b i write to 1 rinse wash repeat. hopefully the driver wont stall as much since i'm not reusing the same VBO info on the next draw.

#5027036 Component based game engine book

Posted by on 29 January 2013 - 07:57 PM

I've seen a lot of people recommend the Jason Gregory book. I have been trying to pick it up. the Stefan Zerbst i believe i have...


Thanks all for the answers. It seems there is yet a component based game engine design book. Shame really...

#5026670 Component based game engine book

Posted by on 29 January 2013 - 12:33 AM

Looking for a good book on component based game engine development. preferably one that doesn't take me through the basics of what a vector and matrix is.


I really like the unity approach as far as a game engine design goes and would like to see about designing my own similarly structured game engine in my free time.


thxs for any input.