Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

fastcall22

Member Since 04 Feb 2008
Offline Last Active Yesterday, 11:34 PM
****-

Posts I've Made

In Topic: c++ include define DIR

15 May 2013 - 07:32 PM

No. The preprocessor does not work like this.


Why do you need a preprocessor variable to define a directory?

In Topic: 3D draw colors bleed into 2D draw colors

29 April 2013 - 09:14 PM

A wild guess, but I see a glEnable/glDisable pair for every OpenGL state except GL_COLOR_MATERIAL. Perhaps your 2d triangles are inheriting your 3d object's green material color?

In Topic: reinterpret_cast problem

13 March 2013 - 01:47 PM

Still,the exercise asks: Why was not each element set to 1? I have no ideea how to explain it

Because you aren't setting each double to 1.0 -- you are setting each individual byte for the first double to 0x01. The layout for your double will be 0x0101010101010101, which is around 7.784e-304, according to IEEE-754.

You probably want to use std::fill instead:
double arr[4] = {};std::fill( arr, arr+4, 1. );

(Also, 1.0 looks like 0x3FF0000000000000 in memory.)

In Topic: Randomly Generating Lines...

06 March 2013 - 01:41 PM

I'm trying to randomly draw lines...
It produces 1 line :/

It's actually drawing the same line 10 times.  This is because you are resetting the RNG after every iteration.  See the System.Random constructor.  The default constructor sets the seed to the current system time in seconds.  Because it takes less than a second to draw those lines, you are getting the same seed, and consequently the same sequence of random numbers.

You'll need to move r before the loop.

In Topic: Including a c file

04 March 2013 - 10:29 PM

Is there a flag I can set on the file to not compile it? Or is there a better way to do it?

Remove the file from the project, and include it -- you can include files that aren't necessarily included in the project.

Alternatively, you can include the c file in your project, and create a header file exposing a handful of pertinent functions...

PARTNERS