Jump to content

  • Log In with Google      Sign In   
  • Create Account


BitMaster

Member Since 08 Aug 2000
Offline Last Active Today, 02:18 PM
*****

#5101765 C++ & SFML?

Posted by BitMaster on 16 October 2013 - 04:13 AM

It's just an initializer list.


#5101289 Problem with Key presses in SDL 2.0

Posted by BitMaster on 14 October 2013 - 07:47 AM

The typical way to deal with that would be to keep the state of the key around as a simple boolean (true means the button is pressed, false means it is released). The button was only pressed if you receive a press event and the state is false, otherwise it's just repeat messages.

I'm not familiar enough with SDL but at least GLFW allows you to configure whether you want to get repeat messages. However, if you intend to do any text input it would be advisable to leave it in.


#5101257 "built-in loop" question

Posted by BitMaster on 14 October 2013 - 05:45 AM

Maybe you should try to see it from a different point of view than your own. From the professionals (or experienced hobbiest) point of view, every single day you have to deal with someone who has been spoiled by bad tutorial or other 'learning material'. In the best case this costs just a bit of time until the poor soul sees that (s)he has wasted a lot of time working under false premises.
In the worst case you get someone with the unfortunate combination of arrogance and stupidity. And someone like that can sour a whole forum for days or weeks until they finally go away or get hit by the ban hammer.

During our learning phase, we (nearly) all seem to go through some phase where we believe we would be a good teacher. Luckily, when I went through that phase there was no real Internet to speak of and the damage I could do was extremely limited.

When given the choice between "not enough tutorials" and "one more bad tutorial" the choice should clearly be "not enough tutorials".

Note also that there is a big difference between trying to help someone with a specific question they are having (like answering someone's question on a forum) and actively setting out to teach (like posting a set of tutorials somewhere). Even then, thinking a bit before posting is useful advise. If the place is any good, plainly wrong advise will quickly land you in trouble.


#5101210 Picking A letter From a Char String

Posted by BitMaster on 14 October 2013 - 01:21 AM

In Visual C++ you may declare:
CString Alphabet = "ABCDEFGHIJK";[/size]
 
the 5th letter out of this string:[/size]
CString c5 = Alphabet.Mid(4,1);[/size]

That is plain horrible advice. There is C++ standard library class which does the same job (only apparently better if Mid(4, 1) is indeed the way to retrieve the character with index 4). CString is useless if you have the intention of writing standard compliant code and perhaps port the program to a different platform. Even when using MSVC only you are pulling in a rather large dependency you really do not need under normal circumstances.


#5100517 OpenGL & Rotation Matices

Posted by BitMaster on 11 October 2013 - 06:50 AM

You might want to consider using something tried and tested like GLM. It also includes several helper functions which replicate the behavior of the deprecated OpenGL functions.

A good matrix/vector library takes quite a bit of effort to write and make bug-free. Unless you have specific needs or requirements rolling your own is nothing but a lengthy and annoying chore.


#5099850 2D OpenGL vs SDL2 Advanced Rendering

Posted by BitMaster on 09 October 2013 - 02:17 AM

Shaders have nothing to do with rendering 3d. You feed a bunch of geometry to OpenGL and that is rendered to 2d. Whether the source geometry is 2d, 3d or actually n-dimensional is of no concern.
What you do with your shaders is entirely up to you too. If you want lighting, then you will probably have to add some additional meta data with your tiles. If you just want some fancy blending and some glow effects then you can do that too. It should be noted that all effects which you could achieve with some texture combiner work can also be done in shaders, usually far simpler too. You can also do a lot of things you could not do before.

Also note, that if you look at any modern smartphone, they will be using OpenGL ES 2 for rendering their entire UI. OpenGL ES 2 is somewhere between desktop OpenGL 2 and OpenGL 3 (plus a few tidbits minus a few other tidbits) and requires you to use shaders (the fixed function pipeline does not exist there at all).

Can you use shaders for a purely 2d game? Definitely.
Will it be useful for what exactly you have in mind? Impossible to answer for an outsider.


#5099581 glPopMatrix does not get what was pushed

Posted by BitMaster on 08 October 2013 - 08:31 AM

According to the docs, GL_STACK_OVERFLOW can be generated. However, since this is completely deprecated functionality it is of course possible modern drivers don't bother anymore.


#5098072 Object tries to destroy itself after Creation.

Posted by BitMaster on 01 October 2013 - 08:59 AM

I have observed you in several different threads by now and I have to concur with wintertime's assessment. Regardless of what you think of your own level of expertise, in a C/C++ environment and the related skills you are just not very far from beginner. That in itself is not a bad thing but unfortunately you tend to have some pretty strong (and frequently rather misguided and ill-informed) opinions which are just not backed up by facts and/or actual experience.
Clear lack of knowledge is not a bad thing, we all started learning at some point. Lack of knowledge and strong (and frequently wrong) opinions comes over as extremely arrogant and tends to rub the actual professionals the wrong way. A lot.

In your own interest you should overthink your behavior. As things look now, in a few weeks there will be only two kinds of people answering your questions: people who feel extremely generous despite previous bad experience and people who haven't encountered you before.


#5097833 rotating vertices

Posted by BitMaster on 30 September 2013 - 08:05 AM

That's nonsense. You can rotate around any point you please with matrices (and obviously by glRotatef). You just have to apply T^-1 * R * T instead of just R, where T is a translation matrix which moves the desired center point to the origin.


#5097829 How to code optional callbacks at expiration of timer?

Posted by BitMaster on 30 September 2013 - 07:56 AM

There is either boost::function or in C++11 std::function. std::function is practically identical to boost::function, however boost::function is available on most compilers (everything remotely modern) even without C++11.


#5097808 include guards for large projects

Posted by BitMaster on 30 September 2013 - 06:04 AM

According to Wikipedia it's fairly widespread. For normal situations relying just on #pragma once should be enough, although I'm not sure how things would look on consoles. I have no real interest nor experience in that area but at least in the past some of the (so-called) C++ compilers used there were very minimalistic.


#5096931 Few questions from starter(ish)

Posted by BitMaster on 26 September 2013 - 05:13 AM

1) Why did graphics go from 2D to 3D back in the days of Doom, was it because DirectX and Opengl were released in 1995 and 1992 respectively?

No. Doom was running in DOS. That was before DirectX, that was before even WinG, that was even before Windows was an OS you would consider for a game. OpenGL had not role on PCs during that time. That said, Doom was not 3D in the sense we would understand it now. It was extremely 2D with some very clever tricks to make it look 3D.

2) What exactly is a graphics library like Opengl, is it written in C/C++,

OpenGL is not a graphics library, it's an API to talk to the graphics card (or maybe a software rasterizer). You could build a graphics library on top of OpenGL. While most OpenGL implementations will be written in C/C++/Assembler you cannot really know how a specific implementation is written nor should you care.

6) Why have graphics improved(better eye candy etc) over the years, is it because of better hardware or more functionality from the graphical APIs such as Direct3D etc?

Graphic APIs advance when the hardware becomes capable of new things (and people have stopped arguing). For example, there would have been no point to add shader programs to either OpenGL or DirectX back in, say, 1998. Hardware back then was happy when it could do a decent job of the fixed function pipeline. Defining an API for something that no one was yet sure how to create in hardware and how exactly it would look then would have been a fool's errand.
Nowadays new drivers can often expose new functionality even on older graphics cards but there are always limits where new functionality is simply impossible for that particular piece of hardware or just not realistic to use in a real world application.


#5096922 Who has implemented a licensing API/SDK

Posted by BitMaster on 26 September 2013 - 04:35 AM

Most DRM solutions are trivial to bypass and generate "valid" keys once folks get even a basic sampling of keys.

 
Any decent DRM system will use public key cryptography to make sure that the only practical way to generate valid keys is to have the private key.
 
Of course that doesn't stop someone hacking the code to remove the check or replace the public key, but at least it lets you easily and reliably identify pirates.


I don't see how that is applicable. If you do not require online validation the program itself needs to validate the key and any decent hacker can extract whatever counts as the private key from the executable.
If you require online validation you don't need public/private keys, it's much simpler and safer in the long run to create completely random keys and store them in a database, together with whatever usage information accumulates.


#5095458 Who has implemented a licensing API/SDK

Posted by BitMaster on 20 September 2013 - 07:19 AM

When The Witcher 2 was released, there was a DRMed disc-based version sold in stores and a completely DRM-free release on GoG.com (as well as some other distribution channels), all at the same time. The game showed up on file sharing sites within hours of being released, however the version showing up there was practically exclusively the cracked, DRM version.
I couldn't find the original interview where that was mentioned but the story is referenced here.

On a more personal note, when I consider buying a game nowadays the first thing I find out is "Does it have DRM?". Unless I can answer quickly that the answer is a simple "No, it does not", I will abandon all intentions of buying the game, no matter how much anything in there interests me.
I have dealt with Steam, I have dealt with other handrolled DRM and I'm just no longer willing to put up with it. On the other hand, I'm spending well over the average when anything in a (DRM-free) Humble Bundle interests me, I have accumulated a rather huge library from GoG and I have left quite a bit of money with several indie developers who go DRM-free (and mark that properly).

A similar attitude is mirrored in friends with the exception that they are generally more accepting of Steam.


#5094602 Compile Shaders/Load Extensions without setting up a window

Posted by BitMaster on 17 September 2013 - 01:14 AM

That is simply impossible. There could be a dozen different graphics cards plugged into a system, each with its own driver and each with its own individual return values for wglGetProcessAdress. Before you create the context there is no way for anyone to know which driver you want to talk to.

If you don't want to do any rendering you still need to create a window (you do not need to make it visible at any point though) and attach a context.




PARTNERS