I am using fixed function pipeline OpenGL 2.
I have been trying for days to understand the basics of Texture Atlases but I can't even figure out where to start.
Can anyone point me in the right direction? I am trying to take a font sheet and translate the texture coordinates around so that I can display a small section of the sprite on my texture.
[QUOTE=false prophet;44602716]I am using fixed function pipeline OpenGL 2.
I have been trying for days to understand the basics of Texture Atlases but I can't even figure out where to start.
Can anyone point me in the right direction? I am trying to take a font sheet and translate the texture coordinates around so that I can display a small section of the sprite on my texture.[/QUOTE]
I would help, but I have to refuse on the principle that you're using the fixed function pipeline :v:
But I don't want to be a total ass about it, so to give a small hint, don't put the glyphs into a texture until you render the entire string. Texture reads are slow.
Also, if you used modern OpenGL you could use texture arrays, which make texture atlases unnecessary [I]hint hint[/I].
[QUOTE=ECrownofFire;44602910]I would help, but I have to refuse on the principle that you're using the fixed function pipeline :v:
But I don't want to be a total ass about it, so to give a small hint, don't put the glyphs into a texture until you render the entire string. Texture reads are slow.
Also, if you used modern OpenGL you could use texture arrays, which make texture atlases unnecessary [I]hint hint[/I].[/QUOTE]
I am trying to gain a general understanding of opengl, that way I don't stroke out when I move to modern opengl. :v:
old fixed function pipeline has nothing in common with the new programmable one!
so you are just wasting your time...
[QUOTE=false prophet;44603500]I am trying to gain a general understanding of opengl, that way I don't stroke out when I move to modern opengl. :v:[/QUOTE]
[url]http://web5.projekti.info/books/3D%20Math%20Primer%20for%20Graphics%20and%20Game%20Development%20(2nd%20Ed)(gnv64).pdf[/url]
You need to read this book (not whole), so you will have idea what the heck is going on (vectors, normals, matrices, rotations, shaders, vertex.. etc)
I want to start learning Objective-C so I can develop apps for my iPhone but I'm only a beginner with programming and I'm not really sure where to start. Should I start with something like Python or is there any book/website that can teach me the fundamentals?
I don't know advanced calculus so I'm kind of hesitant at using modern OpenGL right now :(
[QUOTE=false prophet;44611287]I don't know advanced calculus so I'm kind of hesitant at using modern OpenGL right now :([/QUOTE]
You don't need to know advanced calc to dive into modern opengl. When you're starting off the most you will need to know is basic trig (for camera stuff).
Check out [url]http://open.gl[/url], it's a great start.
I'd dump my opengl resource folder but I'm nowhere near my desktop at the moment.
[QUOTE=false prophet;44611287]I don't know advanced calculus so I'm kind of hesitant at using modern OpenGL right now :([/QUOTE]
Why would you need calculus for modern OpenGL?
Seriously, at most you need some very basic linear algebra, and you need that for the fixed function pipeline too.
Trust me, 90% of the heavylifting is done by GLM. You don't need anything but a few tutorials and a grasp of trig to do most things in OpenGL. Calculus doesn't even touch the subject (at least in all my experiences).
Scratch that, you don't even really need trig.
Okay guys. As soon as I finish understanding texture atlases in my current project I'll start learning modern opengl.
But the moment I need calc for matrix calculations there's going to be hell to pay.
:v:
Still shite at coding so I decided to make a retail simulator will all the random bullshit of real retail. This is gonna be the bit that sets off the game calculations every 5 seconds, and adpated straight from the example code [URL="http://docs.oracle.com/javase/7/docs/api/javax/swing/Timer.html"]here[/URL]
[code]public class GameTick {
long GameSpeed = 5000;
ActionListener tick = new ActionListener(){
public void ActionPeformed(ActionEvent evt){
//Runs game update
}
}; //PROBLEM
new Timer(GameSpeed, tick).start();
}[/code]
On the second last } it says invalid AssignmentOperator no matter if I've got a ; there or not, and removing the 'new Timer...' causes everything else to freak out, so what's wrong?
[QUOTE=ScottyWired;44619652]Still shite at coding so I decided to make a retail simulator will all the random bullshit of real retail. This is gonna be the bit that sets off the game calculations every 5 seconds, and adpated straight from the example code [URL="http://docs.oracle.com/javase/7/docs/api/javax/swing/Timer.html"]here[/URL]
[code]public class GameTick {
long GameSpeed = 5000;
ActionListener tick = new ActionListener(){
public void ActionPeformed(ActionEvent evt){
//Runs game update
}
}; //PROBLEM
new Timer(GameSpeed, tick).start();
}[/code]
On the second last } it says invalid AssignmentOperator no matter if I've got a ; there or not, and removing the 'new Timer...' causes everything else to freak out, so what's wrong?[/QUOTE]
You're writing these directly in a class definition, so you can't just put anything you'd do in a method. Either surround the relevant parts with some method to start them, or add another pair of curly braces around all of it to move it into the initializer (which is normally not good practise but I suppose the limitations of Java legitimate a ton of workarounds).
[QUOTE=ScottyWired;44619652]Still shite at coding so I decided to make a retail simulator will all the random bullshit of real retail. This is gonna be the bit that sets off the game calculations every 5 seconds, and adpated straight from the example code [URL="http://docs.oracle.com/javase/7/docs/api/javax/swing/Timer.html"]here[/URL]
[code]public class GameTick {
long GameSpeed = 5000;
ActionListener tick = new ActionListener(){
public void ActionPeformed(ActionEvent evt){
//Runs game update
}
}; //PROBLEM
new Timer(GameSpeed, tick).start();
}[/code]
On the second last } it says invalid AssignmentOperator no matter if I've got a ; there or not, and removing the 'new Timer...' causes everything else to freak out, so what's wrong?[/QUOTE]
Take a look carefully at the method. Java is lowerCamelCase, and as such [I]ActionPerformed[/I] should be [I]actionPerformed[/I]. Therefore, it's going to moan at you because you're not overriding the correct method.
Also, as Tamschi said, you'll need to put the code inside a method - you can't just put it in the class body.
[code]
public class GameTimer
{
public void start()
{
//the duration of the timer
int gameSpeed = 5000;
//the timer body
ActionListener actionListener = new ActionListener()
{
@Override
public void actionPerformed(ActionEvent event)
{
//do something
}
}
//the timer itself
Timer timer = new Timer(gameSpeed, actionListener);
timer.start();
}
}
[/code]
[editline]23rd April 2014[/editline]
Also, the Timer class accepts an integer for the delay, not a long. Take a look at the [URL="http://docs.oracle.com/javase/7/docs/api/javax/swing/Timer.html"]Javadoc.[/URL]
I have a camera that I want to lock to a moving and rotating vehicle. I take the vehicle's matrix, calculate the offset position and that goes fine and everything stays nicely locked when I move around.
[vid]http://files.1337upload.net/rotationproblem-ba0aba.webm[/vid]
Now I try to add rotation and that doesn't quite work.
[vid]http://files.1337upload.net/rotationproblem2-96a92a.webm[/vid]
So what's the correct way to add rotation to the matrix in this situation?
[editline]23rd April 2014[/editline]
Oh, nvm, works now :)
So I am building a project for a uni class in Java (professor doesn't care what language we use), and I have it all working fine except for... well... this video shows it off perfectly well, I think. The program in question is the one with white text; the other two are just running instances of ncat, which I need to for getting the program to work properly.
Also, sorry for the huge video. Didn't realize it would be that big. :v:
[vid]http://a.pomf.se/xhsxxk.webm[/vid]
The main() method sits on a "while (true) {" loop, and it uses a non-blocking select statement (with non-blocking socket channels, obviously); keyboard input is found by having a BufferedReader on standard in, using the ready() method to grab characters in a non-blocking manner.
Taking out the keyboard part makes no difference, except that the keyboard input isn't actually detected. I can print the characters once enter is pressed, as I do in the video (with "> " prefixing the print), but I can't seem to print them while I am typing them.
Anyone have any ideas?
I have a few questions about application trial/licensing. Have any of you guys bought a license/trial software to use? Are they worth my money? Should I make my own?
I currently have a key system that once you open the application for the first time, you enter your email, and it creates an encryption key. It then creates a record in a database with the email, key, trial end date, paid boolean, and activated boolean. It sets the activated to true so if they find the key, they can't give it to 100 people. Then it saves all this data to a config file. At this point, the user will have started a trial, and the application works till the trial has ended. If they buy it, I change the paid boolean to true, and when the user starts it up this time, it wont be a trial anymore. The only downside is that, a user could delete the config and enter a new email for every trial period.
Is this a good start or should I just buy something? Thanks!
I'm having a couple of issues if anyone happens to be fluent in Haskell.
I have a little script that takes in 2 command line arguments, the first of which is a character which tells the script what needs doing (a mode specifier I suppose). There are (currently) 3 possible modes, two of which perform some calculation on the second argument, the third of which should return a random integer between 1 and 10. First, I'm using a rather ugly if-then-else statement, would this be cleaner using guards? And secondly, I can't get the random number generator working. An example:
[CODE]
import System.Random
funcA :: String -> String
funcA input = ...
funcB :: String -> String
funcB input = ...
funcC :: ?
funcC ?
main = do
[m, i] <- getArgs
if m == "A" then print $ funcA i
else
if m == "B" then print $ funcB i
else print $ funcC
[/CODE]
The function funcC is the one that should return the random number. I've tried several different ways based off of various tutorials, however none compile. Could anyone help us out?
I'm searching for a local version control and i'm thinking of (trying) Git.
I already used SVN a lot before and used a local svn server for it.
The question is: what is a good, free git repository that doesn't require your project to be open source or shall i stick with a local svn?
[QUOTE=ToXiCsoldier;44631354]I'm searching for a local version control and i'm thinking of (trying) Git.
I already used SVN a lot before and used a local svn server for it.
The question is: what is a good, free git repository that doesn't require your project to be open source or shall i stick with a local svn?[/QUOTE]
You can just have a local git repo, you dont seen a git server thats the beauty of distributed version control. But BitBucket offer free private repos for under 5 contributors
Was wondering what the best way of designing this asset manager is. I know I shouldn't get caught up in shit like this but I want your two cents. I have a class with statics that load textures, or if it exists retrieves it's location in memory (since I am using OpenGL). Textures have to be deleted after their lifetime expired. Would having an outer class for the texture manager that's all statics and an inner class that is for each texture (so it just has a location and a destructor that deletes the texture from memory) be the best way of going about doing this? Basically:
[cpp]class TexManager{
struct Texture{
GLuint tex;
Texture(GLuint);
~Texture();
};
static map<string, Texture> textures;
public:
static GLuint getTexture(string);
};[/cpp]
How do you order objects in JavaFX? I'm using
[code]
for (short levelOneStarShort = 0; levelOneStarShort < scenes.windowHeight; levelOneStarShort++)
{
Circle levelOneStar = new Circle(Math.random() * scenes.windowWidth, Math.random() * scenes.windowHeight, 1, Color.web("white", 1));
levelOneStars.getChildren().add(levelOneStar);
}[/code]
to generate one group of objects, and
[code]
Rectangle levelOneStart = new Rectangle();
levelOneStart.setWidth(scenes.windowWidth / 10);
levelOneStart.setHeight(scenes.windowHeight / 10);
levelOneStart.setFill(Color.GREEN);
levelOneStart.setX(0);
levelOneStart.setY((scenes.windowHeight / 2) - (scenes.windowHeight / 10));[/code] to generate the other, but it creates this
[t]https://photos-5.dropbox.com/t/0/AAA7P8qGwM4nYA0j-RE_e0jEfbG6A59C5eQM8vNbzUGHpQ/12/31047547/png/1024x768/3/1398376800/0/2/Overlap.png/xoUPnHUX3dpHDn1mqCAumWjaJk5FOCD6WEmFsqE2KyE[/t]
I'd rather the circles appear behind the rectangles, if this is possible. How would this be done?
[QUOTE=Adam.GameDev;44635037]How do you order objects in JavaFX? I'm using
[code]
for (short levelOneStarShort = 0; levelOneStarShort < scenes.windowHeight; levelOneStarShort++)
{
Circle levelOneStar = new Circle(Math.random() * scenes.windowWidth, Math.random() * scenes.windowHeight, 1, Color.web("white", 1));
levelOneStars.getChildren().add(levelOneStar);
}[/code]
to generate one group of objects, and
[code]
Rectangle levelOneStart = new Rectangle();
levelOneStart.setWidth(scenes.windowWidth / 10);
levelOneStart.setHeight(scenes.windowHeight / 10);
levelOneStart.setFill(Color.GREEN);
levelOneStart.setX(0);
levelOneStart.setY((scenes.windowHeight / 2) - (scenes.windowHeight / 10));[/code] to generate the other, but it creates this
[t]https://photos-5.dropbox.com/t/0/AAA7P8qGwM4nYA0j-RE_e0jEfbG6A59C5eQM8vNbzUGHpQ/12/31047547/png/1024x768/3/1398376800/0/2/Overlap.png/xoUPnHUX3dpHDn1mqCAumWjaJk5FOCD6WEmFsqE2KyE[/t]
I'd rather the circles appear behind the rectangles, if this is possible. How would this be done?[/QUOTE]
Check out the [url=http://docs.oracle.com/javase/8/javafx/api/javafx/scene/Node.html#toFront--]toFront[/url] and [url=http://docs.oracle.com/javase/8/javafx/api/javafx/scene/Node.html#toBack--]toBack[/url] methods.
What would be faster, running a really long regexp checking for multiple words in the same regexp /word1|word2|word3/ etc, or checking the text multiple times for multiple words?
I'm thinking the best way is
string.replace(longRegExp, function(token){return dict[token]});
the dict would be a object and the property for the key would be the replacement for that token.
Now that I've typed this all out, it seems like the best way. Regexp engines are probably more optimized than doing multiple checks, I guess I can test after.
[QUOTE=WTF Nuke;44634595]Was wondering what the best way of designing this asset manager is. I know I shouldn't get caught up in shit like this but I want your two cents. I have a class with statics that load textures, or if it exists retrieves it's location in memory (since I am using OpenGL). Textures have to be deleted after their lifetime expired. Would having an outer class for the texture manager that's all statics and an inner class that is for each texture (so it just has a location and a destructor that deletes the texture from memory) be the best way of going about doing this? Basically:
[cpp]class TexManager{
struct Texture{
GLuint tex;
Texture(GLuint);
~Texture();
};
static map<string, Texture> textures;
public:
static GLuint getTexture(string);
};[/cpp][/QUOTE]
First of all, a static variable is a global variable, so stop doing that. Also, you need to use an unordered_map for that.
It looks alright, but you need to flesh out that Texture struct and have the map return the Texture itself. Give Texture methods to load a texture, to bind it, etc. But binding textures is [I]slow[/I], so I would suggest not doing that method.
You will probably want to use a texture array. Texture arrays are generally MUCH better, mainly because they allow automatic mipmapping, they're faster, and they're a lot easier to work with. However, texture arrays require all texture be the same size. You can somewhat get around this by specifying that all textures' height and width be a power of two so that resizing is really fast and easy.
Following that recommendation, have that map (which should be an unordered_map, by the way) point to the "depth" of each texture, which is a single float, so you can use just 0 and 1 for the coords.
There's also texture atlases, but those are [url=http://0fps.net/2013/07/09/texture-atlases-wrapping-and-mip-mapping/]a pain[/url] to do mipmapping and tiling for, so I don't recommend it if not absolutely necessary.
I need a regexp to match an optional leading quote only if there's not a trailing one, unless there's two leading?
('word) '(word)' '('word)' match would be in parenthesis
how could I do this? using Javascript regular expressions, so no lookbehinds
edit: considering just adding an optional " '? " at the end, and dealing with it in the replace callback.
[QUOTE=ECrownofFire;44635976]First of all, a static variable is a global variable, so stop doing that. Also, you need to use an unordered_map for that.
It looks alright, but you need to flesh out that Texture struct and have the map return the Texture itself. Give Texture methods to load a texture, to bind it, etc. But binding textures is [I]slow[/I], so I would suggest not doing that method.
You will probably want to use a texture array. Texture arrays are generally MUCH better, mainly because they allow automatic mipmapping, they're faster, and they're a lot easier to work with. However, texture arrays require all texture be the same size. You can somewhat get around this by specifying that all textures' height and width be a power of two so that resizing is really fast and easy.
Following that recommendation, have that map (which should be an unordered_map, by the way) point to the "depth" of each texture, which is a single float, so you can use just 0 and 1 for the coords.
There's also texture atlases, but those are [url=http://0fps.net/2013/07/09/texture-atlases-wrapping-and-mip-mapping/]a pain[/url] to do mipmapping and tiling for, so I don't recommend it if not absolutely necessary.[/QUOTE]
I see what you're getting at, but I feel like having a texture array at this point is just premature optimization. Also, I don't see the issue of the map being static. It's private and there's no better way to do it without having a singleton (which would be the same end result of a variable existing throughout the whole lifetime).
[QUOTE=WTF Nuke;44636964]I see what you're getting at, but I feel like having a texture array at this point is just premature optimization. Also, I don't see the issue of the map being static. It's private and there's no better way to do it without having a singleton (which would be the same end result of a variable existing throughout the whole lifetime).[/QUOTE]
Premature optimization doesn't really include making optimizations that are [I]always[/I] faster. Texture arrays are also a lot easier to deal with, generally speaking.
Singletons and static members are globals, and there are [I]numerous[/I] reasons to not use them (the least of which is heavy coupling). And a private static is no different from a public one. It's the difference between Foo::publicStaticMethod() and Foo()::doStuffWithPrivateStatic().
I'm using a leap motion device to recognise gestures and carry out an action. In order to diferentiate between gestures I attempted to add a system timer, the interval is set correctly but the timer won't start after trying both timer.enabled = true and timer.start().
The code below is the method using the timer, the timer is declared elsewhere (Timer timer = new Timer()).
[code]
public override void OnFrame(Controller controller)
{
Frame frame = controller.Frame();
icon.Popup(timer.Interval.ToString());
if (!frame.Fingers.IsEmpty && timer.Interval <= 100)
{
foreach (Gesture gest in frame.Gestures())
{
if (!gest.IsValid)
continue;
switch (gest.Type)
{
case Gesture.GestureType.TYPESWIPE:
SwipeGesture swipeGesture = new SwipeGesture(gest);
if (swipeGesture.Direction.x > 0)
iTunesObj.nextTrack();
else if (swipeGesture.Direction.x < 0)
iTunesObj.prevTrack();
break;
}
timer.Interval = 2000;
timer.Start();
}
}
}
[/code]
How would I begin writing an encoder using the LZ algorithm? I have no idea :S
Sorry, you need to Log In to post a reply to this thread.