• Advertisement

bladeofodinx

Member
  • Content count

    7
  • Joined

  • Last visited

Community Reputation

161 Neutral

About bladeofodinx

  • Rank
    Newbie
  1. don't know what client your using but svn CAN ignore more than just a folder [ and have those settings not just be client side only! ] TortoiseSVN can ignore folders, files [recursively even] and i would bet also by using a regular expression too.   Nowadays i actually use Mercurial with sourcetree but TortoiseSVN is still nice and good and easy.
  2. 3DAudio but do we have 3D occlusion yet?

    fmod can do that!
  3. change void foo_api (std::vector<type>& ref_to_my_populated_vector); to void foo_api (std::vector<type, my_stack_allocator>& ref_to_my_populated_vector);
  4. Per Pixel Rendering

    out of random interest i tried making my own and this is what i made I found it to be on the slow side....with the for loop causing a big slow down. I think i'm going to blame java slowness on this abit. my fps was around 2200 for res:200x200 390: for res:640x480 80: for res:1260x870 I say try to avoid setting all pixels all the time OR greatly reduce the amount of pixels [ via graphically scaling up or something ] import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Image; import javax.swing.JApplet; import javax.swing.SwingUtilities; import javax.swing.JLabel; import java.awt.image.*; import java.awt.Canvas; import java.awt.Graphics2D; import java.awt.Dimension; import java.awt.image.BufferStrategy; import java.applet.Applet; public class PixelRenderer extends Applet implements Runnable { private Thread mainthread; private Image gfxbuffer; private int gfxlastwidth = -1; private int gfxlastheight = -1; private BufferStrategy bufferStrategy; private Canvas drawArea;/*Drawing Canvas*/ public void init() { drawArea = new Canvas(); setIgnoreRepaint(true); } public void start() { if (mainthread == null) { mainthread = new Thread(this); } lasttime = System.currentTimeMillis(); fps_timer = lasttime; mainthread.start(); } // Executed whenever the browser leaves the page containing the applet. public void stop() { mainthread = null; } public void run() { game_init(); drawArea.setSize(new Dimension(getWidth(),getHeight())); game_resize(getWidth(),getHeight()); add(drawArea); drawArea.createBufferStrategy(2); bufferStrategy = drawArea.getBufferStrategy(); //Thread.currentThread().setPriority(Thread.MIN_PRIORITY); while (true) { if ( drawArea.getWidth() != getWidth() || drawArea.getHeight() != getHeight() ) { drawArea.setSize(getWidth(),getHeight()); bufferStrategy = drawArea.getBufferStrategy(); game_resize(getWidth(),getHeight()); } game_update(); // repaint(); Graphics g = bufferStrategy.getDrawGraphics(); game_render( g ); g.dispose(); if(!bufferStrategy.contentsLost()) { //Show bufferStrategy bufferStrategy.show(); } } } //===================================== int[] pixels; int pixel_width; int pixel_height; long lasttime; long fps_timer; long fps_count; long fps_lastvalue; MemoryImageSource dynamic_source; Image dynamic_image; public void game_init() { } public void game_resize(int w, int h) { pixel_width = w; pixel_height = h; pixels = new int[w*h]; dynamic_source = new MemoryImageSource(w, h, pixels, 0, w); dynamic_source.setAnimated(true); dynamic_source.setFullBufferUpdates(true); dynamic_image = createImage(dynamic_source); } public void game_update() { long curtime = System.currentTimeMillis(); long diftime = curtime - lasttime; lasttime = curtime; fps_count++; if ( curtime - fps_timer >= 1000 ) { fps_lastvalue = (long) ( (float)1000*fps_count / (float)((curtime - fps_timer)) ); fps_timer = curtime; fps_count = 0; } } public void game_render(Graphics g) { g.setColor(Color.black); g.fillRect(0,0,getWidth(),getHeight()); //change the pixels array //int pixelindex = 0; for (int pixelindex=0;pixelindex<pixel_height*pixel_width;pixelindex++) //while (pixelindex<pixel_height*pixel_width) { /* pixels[pixelindex] = (255 << 24) | (((int)(255*Math.random())) << 16) | (((int)(255*Math.random())) << 8) | (((int)(255*Math.random())) << 0) ; */ pixels[pixelindex] = (255 << 24) | ( (255) << 16) | ( (0) << 8) | ( (0) << 0) ; //pixelindex++; } //let the dynamic image stuff know that the pixels have been changed dynamic_source.newPixels(); g.drawImage(dynamic_image, 0, 0, null); g.setColor(Color.yellow); g.drawString( "size:"+this.getWidth()+","+this.getHeight()+ " fps:"+fps_lastvalue,50, 50); } }
  5. Per Pixel Rendering

    if that code is happening each frame, your doing far too much first of all, byte[] pixels = new byte[width * height]; should be created once and reused can you avoid doing all that junk at the bottom of the code and just use the MemoryImageSource technique? as for the double for loop with the switch in it [ahhh!] you can at least get rid of the switch be having the particle know what color it is ahead of time [ more memory but you can get rid of the switch ] Also the probably best solution would be getting rid of the double for loop copy code entirely by making the particle update code directly edit the pixel array as they move around at least that's what i'd try
  6. Per Pixel Rendering

    i would try have a precreated array of pixels which is what you actually work on and you render with that instead of setting one pixel at a time might want to look into this function g.drawRGB(int[] rgbData, int offset, int scanlength, int x, int y, int width, int height, boolean processAlpha) Another option if that doesn't work is creating a mutable image from an array of pixels ( just like before ) and drawing that image http://java.sun.com/j2se/1.4.2/docs/api/java/awt/image/MemoryImageSource.html
  7. you could always use winforms with managed c++ [though that might affect pure c++ learning a little bit]
  • Advertisement