Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 18 Sep 2008
Offline Last Active Sep 28 2013 03:05 PM

#5009558 unique_ptr

Posted by on 11 December 2012 - 04:06 PM

1. You don't have to delete it
3. because then some other function can't get a copy of your pointer and then have an invalid pointer after your class is destructed

#4998307 Implementing objects with short life time but that have to be created frequently

Posted by on 06 November 2012 - 08:21 PM

You can save a lot of time once you realize that the order of the bullets in memory doesn't matter. When bullet is deleted, memcpy the last bullet in the list to the deleted bullet's place, that way all the active bullets will be first and you can bust add a new one to the end

#4997349 What key is this ~ in XNA Keys

Posted by on 04 November 2012 - 05:58 PM

~ is a tilde

#4994581 Should rendering geometry and physics geometry separated?

Posted by on 27 October 2012 - 05:42 PM

Usually you don't use high resolution graphical assets for the physics, you'd either use really low quality versions or primitive shapes (boxes, cylinders). Either way, you need to store two versions, and the physics one should take up much less space than the rendering version. Plus, that data really isn't that big, compared to even a single texture

#4994317 Trouble with Quaternion camera motion.

Posted by on 26 October 2012 - 07:00 PM

Instead of extracting the eulwr angles, I just create a rotation matrix from the quaternion, and then multiply it by vec3(0,0,-1) for forward, vec3(1,0,0) for right, etc

#4987433 Questions about Intel Sample

Posted by on 06 October 2012 - 10:37 AM

The << is a bitshift. It shifts the number (1 in this case) left ten bits, which is the equivilant of multiplying 1 by 2^10. 2^10=1024, 1024*1=1024

#4987271 Software Renderers?

Posted by on 05 October 2012 - 04:08 PM

Here's a few renderers I've got sitting around. One came from an old book I have, the other two I coded years ago. The code isn't very pretty, but maybe they can help you out a bit. I recently coded a much nicer renderer, but it's a module in my main engine, so if I uploaded just the renderer parts you wouldn't be able to compile it, but I could still upload them if you want...


#4981088 Particles on the GPU

Posted by on 17 September 2012 - 06:59 PM

As long as your particles are just quads it will be much easier (and more efficient) to use point sprites. I'd suggest you look into them before you go diving into geometry shaders

#4981083 Particles on the GPU

Posted by on 17 September 2012 - 06:53 PM

What GL version you targeting?

#4981080 Particles on the GPU

Posted by on 17 September 2012 - 06:50 PM

Should be doable then :) Is the game 3D or 2D?

#4981076 Particles on the GPU

Posted by on 17 September 2012 - 06:42 PM

A Geometry shader can create polygons on the GPU. The most important question, however, is do you need the particles to collide with the level geometry? (if so you'd need to have the entire physics level on the gpu etc and I don't think it would be worth it. If your particles just follow some mathmatic trajectory (say they just have position, velocity, and acceleration) then you could just pass those to the GPU once and let the GPU integrate the new position each frame quite easily. If you're working in 2D or can use point sprites you don't even need a geometry shader.

#4970381 OpenGL Texture Blur?

Posted by on 16 August 2012 - 05:51 PM

After you've bound the texture with glBindTexture

#4969927 Enemy faces player

Posted by on 15 August 2012 - 02:06 PM

Do you rotate the turret using an angle? If so, you can use atan2 to get the angle from the turret to the player's position.

#4966726 OpenGL 3/4 - 3D Without Lights, and Shader Basics

Posted by on 06 August 2012 - 11:36 AM

gl_Position acts just like it does in GL2.
in variables act like generic vertex/normal arrays. When you upload vertex data from your opengl program, you tell it which variable (in_Position,in_Color) to link it to. Each vertex in the array you upload goes to the vertex shader once.
Out variables are like varying variables. They get interpolated and given as INputs in the fragment shader, which knows they're the same because they have the same name.
If you understood GL2 shaders all you need to recognize is that with GL3 there are less hard-coded variables. Instead of using gl_Normal to pass a variable to the fragment shader, you just make your own variable called normal

#4960606 Polygon and texture accuracy

Posted by on 18 July 2012 - 01:03 PM

The PSX used integer coordinates some place in its rendering pipeline to speed it up, which would make the vertices wobble slightly as they were moved across the screen. If that box is more than just 6 sides (the places the line changes being new polygons) then that would explain it