Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 278 279 [280] 281 282 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 907453 times)

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4185 on: March 10, 2013, 09:03:23 am »

Am I doing this right?

http://pastebin.com/87ZUe64p

I'm not sure why defined next to #if is blue, but defined next to #define isn't... @_@

1. Get rid of the #defines that set stuff to 0
2. Move the #defines and #undefs to the top, before you start including the headers.
3. The directives should look like this:

Code: [Select]
#define CL_VERSION_1_0                              1
#undef CL_VERSION_1_1
#undef CL_VERSION_1_2

defined() is a macro function that returns 1 if the macro is defined, and 0 if it's not. You can't assign values to it; instead, assign values directly to the macros. Since the C++ binding checks if the macro is defined, rather than its value, you have to undef the unwanted macros and never redefine them.

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #4186 on: March 10, 2013, 09:16:57 am »

Exe
misc dlls

Delete the exe inside the zip and use the deviceprofile5.exe. I don't think it's helping >_>
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4187 on: March 10, 2013, 03:18:40 pm »

So I was away over the weekend, and it looks like people missed me. Skyrunner, what exactly are the problems you currently have?
Logged

olemars

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4188 on: March 10, 2013, 03:22:25 pm »

I don't think it's helping >_>
Certainly doesn't help that you're getting contradictory information   :-\

2. Move the #defines and #undefs to the top, before you start including the headers.
Nooooo. When you're trying to redefine, or in this case undefine, a #define from an included file, the redefinition has to be after the #include or it won't have any effect.

Quote
3. The directives should look like this:

Code: [Select]
#define CL_VERSION_1_0                              1
#undef CL_VERSION_1_1
#undef CL_VERSION_1_2

defined() is a macro function that returns 1 if the macro is defined, and 0 if it's not. You can't assign values to it; instead, assign values directly to the macros. Since the C++ binding checks if the macro is defined, rather than its value, you have to undef the unwanted macros and never redefine them.

This is correct.
Logged

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4189 on: March 10, 2013, 03:32:39 pm »

So I was away over the weekend, and it looks like people missed me. Skyrunner, what exactly are the problems you currently have?
Actually if you want to write up a tutorial on using OpenGL in lwjgl I'm sure I'm not the only one who will ever use it.
I like most of your class structure, by the way.

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4190 on: March 10, 2013, 06:32:00 pm »

Actually if you want to write up a tutorial on using OpenGL in lwjgl I'm sure I'm not the only one who will ever use it.

About half done, will finish tomorrow.
Logged

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4191 on: March 10, 2013, 06:42:24 pm »

2. Move the #defines and #undefs to the top, before you start including the headers.
Nooooo. When you're trying to redefine, or in this case undefine, a #define from an included file, the redefinition has to be after the #include or it won't have any effect.
[/quote]

Isn't he trying to define the version so that, when he includes the header, the preprocessor will read it and generate the proper code? Or am I misunderstanding the problem?

Like so:

Code: (opencl.h) [Select]
#if defined(CL_VERSION_1_0)
// code he wants
#endif
#if defined(CL_VERSION_1_1)
// code he doesn't want
#endif
// and so on

olemars

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4192 on: March 10, 2013, 07:16:37 pm »

No, the defines are already in the header and in turn generates the improper code in the c++ bindings, which are including that header. Thus the need to undef some of those defines to target the older version. Which is slightly hacky, but I can't see any better way.

The real problem is that the Khronos sample implementation, and the AMD SDK with it, doesn't have any good mechanism for targeting a specific API version. So if you have the newest SDK (which includes OpenCL 1.2) but want to target OpenCL 1.0 or 1.1 to support a wider array of hardware you have to do hacks like this.
Logged

Nadaka

  • Bay Watcher
    • View Profile
    • http://www.nadaka.us
Re: if self.isCoder(): post() #Programming Thread
« Reply #4193 on: March 10, 2013, 09:13:20 pm »

No I remember why I abandoned my last couple coding projects outside of work... I was trying to do comprehensive unit tests.. and its boring as hell.
Logged
Take me out to the black, tell them I ain't comin' back...
I don't care cause I'm still free, you can't take the sky from me...

I turned myself into a monster, to fight against the monsters of the world.

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4194 on: March 11, 2013, 11:06:28 am »

OpenGL 1.1 with LWJGL! Go learn something.

EDIT: By the way, that's an Eclipse project too.
« Last Edit: March 11, 2013, 12:05:03 pm by MagmaMcFry »
Logged

forsaken1111

  • Bay Watcher
    • View Profile
    • TTB Twitch
Re: if self.isCoder(): post() #Programming Thread
« Reply #4195 on: March 12, 2013, 12:00:11 am »

Just posting to watch and say I've recently started learning Java myself. Doing well so far, I can make things add!
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #4196 on: March 12, 2013, 12:05:36 am »

OpenGL 1.1 with LWJGL! Go learn something.

EDIT: By the way, that's an Eclipse project too.
I was totally like "OpenCL 1.1 with LWJGL?! AWESOME :D" then I saw that it's Java then I saw that it's GL. :<



edit: Yessss, it works. I am now ready to proceed to create an unoptimized version of the simulation. I need to decide whether to keep the object oriented original or just unpack it all into arrays.
« Last Edit: March 12, 2013, 09:40:11 am by Skyrunner »
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

alway

  • Bay Watcher
  • 🏳️‍⚧️
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4197 on: March 14, 2013, 04:57:01 am »

Whelp you're right.


Edit: Screw me, of course you can't find the maximum of an array in log(n) time, since if no assumptions can be made about the array, every element needs to be checked.
Fun fact addendum to this particular discussion:
While you cannot find an element in an unsorted array in less than O(n) time with classical computing, you can find it in O(n^(1/2)) time using quantum computing. http://en.wikipedia.org/wiki/Grover's_algorithm

Though practical quantum computers are still likely a decade or two away. But still; it's something we will definitely need to learn how to use at some point in the not-distant future.
Logged

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4198 on: March 14, 2013, 05:20:59 am »

Well, I doubt quantum computing will make the current computer-systems obsolete for a very long while, but a plug-in quantum card (just like you have a video card now) could become a thing, perhaps.

Are there any quantum-computer-emulators out there, yet? It'll be magnitudes slower than the actual thing, but you'd be able to test algorithms on small samples.
Fake edit: of course there are, google is my friend.
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #4199 on: March 14, 2013, 07:17:18 am »

What are the odds? I was thinking of quantum computing and that no matter what people may think, it's going to be as hard or even harder to use in virtual reality or gaming aspects as GPGPU is now :P Quantum computers could revolutionize the simulation industry or such, though, with speedup ...
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward
Pages: 1 ... 278 279 [280] 281 282 ... 796