Do you suggest using SDL 1.3.0?
It will be a good start
As proanim@ mentioned its now 2.0 and should be cloned/compiled from mercurial repo.
Male
santa01 hasn't added any contacts yet.
Posted by santa01
on 06 February 2013 - 11:49 AM
Do you suggest using SDL 1.3.0?
It will be a good start
As proanim@ mentioned its now 2.0 and should be cloned/compiled from mercurial repo.
Posted by santa01
on 06 February 2013 - 06:17 AM
glXSwapIntervalEXT is not crossplatform, for win you should call wglSwapIntervalEXT. Also, if I am not mistaken, for glXSwapIntervalEXT you should link against libX11 as -lX11
Also you can look at this post: http://forums.libsdl.org/viewtopic.php?p=24220&sid=a85c51359b9040234fece5114e1d5787#24220
Posted by santa01
on 29 December 2012 - 04:44 AM
kill(getpid(), SIGTERM);
I'd suggest also to install a handler for this signal to perform any manual cleanups like finishing network sessions properly, dump config files etc.
Posted by santa01
on 28 December 2012 - 04:47 AM
I haven't found any OpenGL gamedev books for OpenGL3 or higher. I guess its worth sticking to OpenGL3/4 tutorials over the net + look throught some `generic gamedev books' which would give you an insight into the basic math.
Posted by santa01
on 27 December 2012 - 02:44 PM
I don't think there is a function to lock the cursor in position (shame on me if I'm wrong), but you can call XWarpPointer every time you receive a mouse event, which has the same effect.
sorry for plusing your answer
its not exactly the way its done. XWarpPointer() would move the cursor and produce the mouse event itself, performance falls drastically for no good reason. its better to call XWarpPointer() after the event queue is empty:
while (XPending(display)) {
XNextEvent(display, &event);
// process you events
}
XWarpPointer(...);
or you can look through the freeglut sources to find out how its implemented for X11.
Posted by santa01
on 27 December 2012 - 02:36 PM
I keep reading this, but never an explanation. Being curious, I took a look at Visual Studio's code for rand and srand and all srand does is set a global variable. rand performs a typical pseudo-random number algorithm based on the global variable.
because you just don't need to do that, its like checking variable twice just to make sure its value is consistent. just do
// time() returns the time as the number of seconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). srand(time()); // well not sure time() is present in MSVC
Posted by santa01
on 26 December 2012 - 06:16 PM
If you want to make your output function have a flexible choice of destination, you can make it take a std::ostream & argument for destination. Then whoever uses it can dump it to a std::stringstream, std::cout or a std::fstream. One option is to just overload std::ostream & operator<<(std::ostream &, const YourClass &) so you can use the formatted output operator.
This. And for requirement (1) I'd wrap the sprintf() call to make a fancy formatting (sorry for non C++ approach, but I don't know any decent STL classes to solve this issue).
Posted by santa01
on 26 December 2012 - 06:10 PM
Why do you guys load shader sources line by line? Thats a extra runtime. Shader sources aren't very big, everything can be done with one read:
GLuint ShaderLoader::shaderFromFile(const std::string& name, GLenum type) {
std::fstream file(name.c_str(), std::ios::binary | std::ios::in);
if (!file.good()) {
Logger::getInstance().log(Logger::LOG_ERROR, "Cannot open file %s", name.c_str());
return 0;
}
file.seekg(0, std::ios::end);
int sourceLength = file.tellg();
GLchar* shaderSource = new GLchar[sourceLength + 1];
file.seekg(0, std::ios::beg);
file.read(shaderSource, sourceLength);
shaderSource[sourceLength] = 0;
GLuint shader = glCreateShader(type);
glShaderSource(shader, 1, (const GLchar**)&shaderSource, NULL);
glCompileShader(shader);
delete[] shaderSource;
GLint compileStatus;
glGetShaderiv(shader, GL_COMPILE_STATUS, &compileStatus);
if (compileStatus == GL_FALSE) {
GLint infoLogLength;
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLogLength);
GLchar* infoLog = new GLchar[infoLogLength + 1];
glGetShaderInfoLog(shader, infoLogLength, NULL, infoLog);
Logger::getInstance().log(Logger::LOG_ERROR, "In file %s: %s", name.c_str(), infoLog);
delete[] infoLog;
}
return shader;
}
Posted by santa01
on 26 December 2012 - 05:52 PM
OpenGL standard doesn't describe how VBO binding should be implemented internally, I guess this would be vendor specific, whereas reducing draw calls would give you an average performance boost.
Posted by santa01
on 25 August 2012 - 09:03 AM
Find content