• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

198 Neutral

About LucidIon

  • Rank
  1. Unix Sort command

    I suspect that it is sorting the value, just not as you expect it to. It's not going to sort dates correctly (it'll sort months if you ask nicely though). By default, it's alphabetic - so July 1, 2005 is before September 9, 1904. Sorting dates is quite tricky - ideally, have them all in a consistent format, like, days since a particular point, and then sort them. The Squid Webcache stores it's times as milliseconds since January 1, 1970.
  2. helping program an average program in C

    Using a switch statement for something where you'd expect an if statement can have readability issues. (I'd also expect many compilers to implement the switch via an if statement, rather than a computed jump.) #include <string.h> if(!strchr("AaBbCcDdEeFf",answer)) break; The fastest way is probably a (non-portable) character range comparision - it'll probably screw up if you're not using ASCII (or by extension the ASCII subset of UTF8), of course. if((answer<'A' || answer>'F') && (answer<'a' || answer>'f')) break; Speaking of Unicode, there's a number of things that would be problematic for programs that didn't use the (Unicode) standard library functions (in this case wstrchr) for example, where some sequences of codepoints are equivalent to some codepoints...but I digress.
  3. Nvidia driver trouble

    I believe that there is Riva 128 3D support, in the Utah-GLX project. It's listed as 'Works. (runs Quake!)' http://utah-glx.sourceforge.net/ It doesn't look very easy to get working though.
  4. OpenGL Drawing directly to the screen in OpenGL

    I'd say that you would be better drawing to the screen using triangles/quads with an orthographic projection, but, you could use glDrawPixels, which copies memory to the framebuffer.
  5. Trying Linux

    A LiveCD is an excellent way of trying out Linux. It's not a totally accurate experience - speed of CD drive etc., but close. Particularily if you're using x86 (LiveCD's for Macs etc are rarer) it's a convenient and hassle free way of trying Linux. I'd recommend Knoppix, in my experience, it just works. Using a LiveCD is very easy, on any reasonably recent machine, put the CD in the drive, reboot your computer. That is assuming it's set in the BIOS, to boot from CD, before hard disk (most are). I think the minimum for Knoppix is 128MB of RAM, but more is better. I don't think most LiveCDs include drivers for nVidia or other recent 3D cards due to licensing, although they are available, so don't expect accelerated 3D graphics.
  6. Clarification about LGPL

    I think that you would be best to ship a copy of the library source alongside your app. I've noticed 'big' developers using LGPL libraries, do this. (SDL source is shipped with Neverwinter Nights and UT2004.) As I read it, you must supply or offer to supply the library, whether or not you make changes.
  7. how can i end a while loop ??

    Isn't EOF ^d (CTRL-d) rather than ^z (CTRL-z)? IIRC, CTRL-c is quit, CTRL-d is EOF, CTRL-z is background, CTRL-s is software flow control stop, CTRL-q is software flow control start...at least on 'nix. AFAIK it's just the normal ASCII set.
  8. Trouble with OpenGL

    I think you need to perform the rotation and translations in the opposite order. glRotatef(theta, 0.0f, 0.0f, 1.0f); glTranslatef(-0.25f, 0.0f, -6.0f); You want to rotate the square and then move it, rather than move the square then rotate, as the rotation occurs around the origin.
  9. Missing directories on Red Hat disks

    Strange. The RedHat 9 images and dosutils are here [ftp.redhat.com] though. They should have been on the first disk (as I'd have thought the disks are pretty much an image of that ftp directory and a boot block)
  10. I think most GNU programs have the clause ' This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.' Compilers are interesting. Technically, you include some of the compiler libraries by with your code. Hence the GCC library libgcc has an exception clause so that compiled code does not fall under the GPL by mere linkage (if you were to make your own compiler library by cutting and pasting libgcc code then you'd need to license your library under the GPL)
  11. OpenGL Drawing Normal in OpenGl

    If a is your normal and p the particle position, then. p is the start and l*a+p is the end. l being the desired length.
  12. As far as I know OpenGL was not supported under DOS. Either you need to install drivers that support OpenGL or if that's not possible, buy hardware that has support. An old computer may not have a graphics card that supports 3D acceleration, OpenGL is a 3D graphics API if you don't have 3D acceleration hardware, OpenGL will not be accelerated - the best you will get is a software fallback.
  13. C# is not good?

    I think from a programming skills perspective the best things I've done were: a) Learning how computers work. b) Using multiple languages. c) Low-level programming. Essentially, knowing how the `bare metal' works is the basis of a lot of programming particularily when you want speed. Learning multiple languages is also useful. Particularily, loosely related languages (eg., C and Haskell). The ideas that you learn from one language can enhance your programming in another. If you have the time go and do a good degree. Go to your lectures. You can learn much. And on the console front, consider that few of the truly great games have amazing graphics or sound.
  14. Texture Qualiy Setting

    Take blocks of 4 pixels: (x,y), (x+1,y) (x,y+1) (x+1,y+1) and average together the pixels. for(j=height;j>0;j-=2) { for(i=width;i>0;i-=2) { pixel1 = *srcbitmap; pixel2 = *(srcbitmap+width); pixel3 = *(++srcbitmap); pixel4 = *((srcbitmap++)+width); channel1 = (pixel1&255) + (pixel2&255) + (pixel3&255) + (pixel4&255) + 2; channel2 = ((pixel1>>8)&255) + ((pixel2>>8)&255) + (pixel3>>8)&255) + ((pixel4>>8)&255) + 2; channel3 = ((pixel1>>16)&255) + ((pixel2>>16)&255) + (pixel3>>16)&255) + ((pixel4>>16)&255) + 2; channel4 = ((pixel1>>24)&255) + ((pixel2>>24)&255) + (pixel3>>24)&255) + ((pixel4>>24)&255) + 2; *(dstbitmap++) = (channel1>>2) + ((channel2>>2)<<8) + ((channel3>>2)<<16) + ((channel4>>2)<<24); } } Produces the next mipmap level. It's not the best type of filtering (this is a box filter) but it's pretty fast, although it's not the fastest possible code. If you store textures with mipmap levels, wouldn't it take 1/3 more disk space, and hence more time to load unless you compress - remember that disks are much slower than CPUs.
  15. OpenGL Inversion of R-B pixel values

    of course you could always do something like // ensure GL_BGR is defined #ifndef GL_BGR #ifdef GL_BGR_EXT #define GL_BGR GL_BGR_EXT #else #error "GL_BGR is not defined, nor can define GL_BGR from GL_BGR_EXT #endif Then your code should continue to work, no matter if constants change (perhaps on some platforms?) or if GL_BGR_EXT is removed. Obviously, now you've got the appropriate colour format, there shouldn't be the inversion problem. You could also use OpenGLs fragment processing to handle it (you can multiply colour values by a matrix). so something like: R G B A 1 [ 0 0 1 0 0 ] R [ 0 1 0 0 0 ] G [ 1 0 1 0 0 ] B [ 0 0 0 1 0 ] A [ 0 0 0 0 1 ] 1 would swap red and blue (I'm working from shaky memories here though).
  • Advertisement