My machine has OpenGL 4.2 installed, but when I try using some features of OpenGL (such as glTexSubImage) they don't appear on my intellisense in VS2010. Are my libraries outdated? Where do I get the latest versions? I got them from the OpenGL superbible (GLTools.lib, OpenGL32.lib).
I hope i'm posting this in the right place - i didn't want to make a new thread too.
I need help choosing a language(s) to learn.
I'm really new at this, i have been learning web dev for 4/5 years now - still need to improve my php, javascript and design skills.
What do you think is the best language and place to start and make a few programs, games, electronics and robotics stuff? I'd been reading something about starting with python and C, moving up to java and assembly and then C++.
Sorry if i'm explaining myself like a 9 year old and talking like a complete moron on this subject but i really want to move up then just staying a guy who can make sites and a few web apps.
[QUOTE=asantos3;35808909]I hope i'm posting this in the right place - i didn't want to make a new thread too.
I need help choosing a language(s) to learn.
I'm really new at this, i have been learning web dev for 4/5 years now - still need to improve my php, javascript and design skills.
What do you think is the best language and place to start and make a few programs, games, electronics and robotics stuff? I'd been reading something about starting with python and C, moving up to java and assembly and then C++.
Sorry if i'm explaining myself like a 9 year old and talking like a complete moron on this subject but i really want to move up then just staying a guy who can make sites and a few web apps.[/QUOTE]
To be honest, you don't really need a "starter" language. I'd recommend C++ to everyone wanting to learn how to code, because it's widely used and, to me, the syntax and style of the language is just right, not too wordy but not cryptic like assembly (although one is high level and one is low.)
Stick to one language, learn it through and through from the beginning. C++ is probably the way to go.
GLSL newbie question:
[code]
uniform vec4 targetcolor;
uniform float dt;
void main(void) {
gl_FragColor += (targetcolor-gl_FragColor)*dt;
}
[/code]
I'm trying to interpolate between colors and this won't work. How do I get the result from the last pass?
[QUOTE=Mordi;35808842]My machine has OpenGL 4.2 installed, but when I try using some features of OpenGL (such as glTexSubImage) they don't appear on my intellisense in VS2010. Are my libraries outdated? Where do I get the latest versions? I got them from the OpenGL superbible (GLTools.lib, OpenGL32.lib).[/QUOTE]
Use GLEW. The situation with getting OpenGL all set up on Windows is convoluted.
[QUOTE=Protocol7;35809009]To be honest, you don't really need a "starter" language. I'd recommend C++ to everyone wanting to learn how to code, because it's widely used and, to me, the syntax and style of the language is just right, not too wordy but not cryptic like assembly (although one is high level and one is low.)
Stick to one language, learn it through and through from the beginning. C++ is probably the way to go.[/QUOTE]
I'd agree with the idea that some people can jump right into a 'difficult' language (they aren't, really), but C++ is really a shit language to recommend to beginners. In every regard.
And you don't need to start with a 'difficult' language, either. You probably don't gain too much by doing so.
[QUOTE=Cassel;35810674]GLSL newbie question:
[code]
uniform vec4 targetcolor;
uniform float dt;
void main(void) {
gl_FragColor += (targetcolor-gl_FragColor)*dt;
}
[/code]
I'm trying to interpolate between colors and this won't work. How do I get the result from the last pass?[/QUOTE]
If you're [i]determined[/i] to use that method, ping-pong it with FBOs.
Really, though, it's probably better to either:
1. Pass both source textures in, and calculate the full blended output directly each frame.
2. Keep an 'accumulator' FBO and blend the destination with some source image each frame.
[QUOTE=mlbfan560;35807338]You want to use [[NSBundle mainBundle] pathForResource] to get the path of the file.[/QUOTE]
Is there a c++ version of that somewhere?
[QUOTE=Cassel;35810674]GLSL newbie question:
[code]
uniform vec4 targetcolor;
uniform float dt;
void main(void) {
gl_FragColor += (targetcolor-gl_FragColor)*dt;
}
[/code]
I'm trying to interpolate between colors and this won't work. How do I get the result from the last pass?[/QUOTE]
If I understand you correctly then you could make it render to an off-screen buffer, and then on every rendering step you can pass the last copy of that buffer to the shader as a sampler.
[QUOTE=NateDude;35808192][IMG]http://puu.sh/sIxj[/IMG]
And I'm trying to install the 2010 Version.
[B]Edit:[/B] Fucking hell
If I can't figure out how to get this to work, I'm gonna be pissed.
I was really excited to learn how to code, but NOW....[/QUOTE]
I meant are you trying to install the "online" or "offline" version. If you are trying to install the online version, go download the offline version, and give that a shot.
I've never heard of someone having such large problems just trying to install VS. If all fails, you could just go download another IDE, such as Code::Blocks or Eclipse.
[QUOTE=ROBO_DONUT;35811062]I'd agree with the idea that some people can jump right into a 'difficult' language (they aren't, really), but C++ is really a shit language to recommend to beginners. In every regard.
And you don't need to start with a 'difficult' language, either. You probably don't gain too much by doing so.[/QUOTE]
C or any of its derivatives, then. I'm not saying people will gain much by learning a "difficult" language, but what worked for me was finding a language that is widely popular, and just rolling with it. I went back and forth with c++ and Java and didn't like Java because it omitted some things that C++ has.
Moreover, I'm not a fan of the idea of graduating yourself into more "difficult" languages. Core concepts in coding remain largely the same between languages.
In C#, I need to split a byte array in the format of [executable file #1][string][executable file #2] using the string in the middle as a delimiter. The only way I can think of is to convert the byte array into a string but text encoding confuses me. What encoding should I use if I want to keep the executable files in a working state?
Just use an ASCII comma?
(As long as there are no ASCII commas in the executables themselves)
[editline]4th May 2012[/editline]
I'd suggest just prefixing the executables with their lengths honestly if that's a possibility.
[QUOTE=_NewBee;35811161]Is there a c++ version of that somewhere?[/QUOTE]
Not that I know of.
Hi,
I'm working with Gwen and nothing is showing up on screen. I'm wondering if it's my init process screwing everything up.
This is my code:
[CODE]
gRenderer = new Gwen::Renderer::OpenGL_DebugFont();
gRenderer->Init();
gSkin = new Gwen::Skin::TexturedBase(gRenderer);
gSkin->Init("images/DefaultSkin.png");
gCanvas = new Gwen::Controls::Canvas (gSkin);
gCanvas->SetSize(1200,800);
gUnit = new UnitTest(gCanvas);
gUnit->SetPos(500, 10);
gInput = new Gwen::Input::Windows;
gInput->Initialize(gCanvas);
gButton = new Gwen::Controls::Button(gCanvas);
gButton->SetBounds(10,10,200,10);
gButton->SetPos(500,500);
gButton->SetSize(200,200);
gButton->SetText("My First Button");[/CODE]
This is my result:
[IMG]http://a4.sphotos.ak.fbcdn.net/hphotos-ak-ash4/471244_233285500106294_100002745382308_333522_175589141_o.jpg[/IMG]
I want to zoom in and out in SFML by changing the view, I am doing it this way:
[cpp]void Game::changeView(sf::Vector2f p)
{
//p.x = (int)p.x;
//p.y = (int)p.y;
if(p.x > 0 && p.y > 0){
std::cout << p.x << ":" << p.y << std::endl;
sf::View view;
view.setSize(p.x, p.y);
view.setCenter(App.getView().getCenter());
App.setView(view);
}
}[/cpp]
[cpp]if(event.type == sf::Event::MouseWheelMoved)
{
float amount = 10 * event.mouseWheel.delta;
sf::Vector2f p = App.getView().getSize();
p.x += amount * (0.576f);
p.y += amount * (1.024f);
changeView(p);
}[/cpp]
But how can I make sure that it always stays at the same aspect ratio?
[editline]4th May 2012[/editline]
Does this work? [cpp]p.x += amount;
p.y = p.x / 1.77777778f;[/cpp]
[QUOTE=Topgamer7;35811777]I meant are you trying to install the "online" or "offline" version. If you are trying to install the online version, go download the offline version, and give that a shot.
I've never heard of someone having such large problems just trying to install VS. If all fails, you could just go download another IDE, such as Code::Blocks or Eclipse.[/QUOTE]
I'm so retarded.
I didn't know there was an offline version.
Like I said, I'm new to coding as a whole. Never done it any time in my life (Other then trying to make a shitty Gmod addon to execute "Hello World!" only for it not to work). And I [I]still have no experience[/I] because I can't even get it to work.
Trying it now. I'm so dumb.
[B]Edit:[/B] I don't even know how to download the offline installer, because I can't find it anywhere.
I sware to god I'm retarded :suicide:
[QUOTE=NateDude;35816069]I don't even know how to download the offline installer, because I can't find it anywhere.[/QUOTE]
[url=https://www.microsoft.com/visualstudio/en-us/products/2010-editions/express-iso]Here[/url]. The "offline" install just means it doesn't have to download while installing, because it's all been downloaded beforehand. It's the same software.
[QUOTE=Wyzard;35816322][url=https://www.microsoft.com/visualstudio/en-us/products/2010-editions/express-iso]Here[/url]. The "offline" install just means it doesn't have to download while installing, because it's all been downloaded beforehand. It's the same software.[/QUOTE]
Thanks.
I'll try not to be so useless once I actually begin coding, I've been stumbling along and probably annoying you fine folks and I haven't even [I]started[/I].
Sorry for the trouble, you guys.
Its alright man, we all have something that makes us stumble. For you its installing the compiler. For me its getting shit to render right.
I don't know why but for some reason my program only draws around maybe half of the triangles it should be. Stops around the 32,000th one or so.
[QUOTE=darkrei9n;35816865]Its alright man, we all have something that makes us stumble. For you its installing the compiler. For me its getting shit to render right.
I don't know why but for some reason my program only draws around maybe half of the triangles it should be. Stops around the 32,000th one or so.[/QUOTE]
Integer limit?
[QUOTE=Lord Ned;35817034]Integer limit?[/QUOTE]
Figured it out, I was passing the number of faces not the number of integers.
Hey guys.
So I'll admit I'm fairly fresh with the C++ game, but I'm not sure where the problem is here.
Firstly, some background: I am using SFML, and decided that, because the SoundBuffer object in SFML is expensive to instantiate, I want to create a manager to optimize its usage. How this manager will work is I call a "PlaySound" method, with a filepath as an argument, on the manager - the manager will then go through an array of objects it has stored on itself. If there is a SoundBuffer in that array that is tied to that filepath, then it will simply use that buffer, rather than make a new one. If there is no buffer tied to that filepath, then it'll make a buffer for it, store it, and use that buffer.
To tie SoundBuffers and filepaths together, I decided to make what I call a ManagerObject_Sound, which, when provided with a filepath, will store that filepath, and then create and store a SoundBuffer for that filepath. Real simple.
However, I am having some issues.
[b]Firstly[/b], I'm not exactly sure how to handle the sf::SoundBuffer, because the class is such that you can simply do [code]sf::SoundBuffer buffer;[/code] and it'll create the SoundBuffer into the variable "buffer." I have no idea how to create the class in such a way that it can store an object of the type sf::SoundBuffer, because I imagine if I just do something like [code]class ManagerObject_Sound {
public:
// Define the variables to be used in the constructor
sf::SoundBuffer buffer;
// Define the constructor
ManagerObject_Sound();[/code] then it'll just create a buffer right then and there.
[b]Secondly[/b], using the code below, I get compile errors:
[code]#include <SFML/Audio.hpp>
using namespace std;
class ManagerObject_Sound {
public:
string filepath;
sf::SoundBuffer* buffer;
ManagerObject_Sound(string);
bool IsForFile(string);
sf::SoundBuffer* GetSoundBuffer();
}
ManagerObject_Sound::ManagerObject_Sound(string fpath)
{
filepath = fpath;
buffer = new sf::SoundBuffer();
if (!buffer.LoadFromFile(fpath))
{
// Error loading
}
}
bool ManagerObject_Sound::IsForFile(string fpath)
{
return (filepath==fpath);
}
sf::SoundBuffer* ManagerObject_Sound::GetSoundBuffer()
{
return buffer;
}[/code]
[code]1>c:\users\jason\documents\visual studio 2008\projects\ragnarok_client\ragnarok_client\manobj_sound.cpp(16) :
error C2533: 'ManagerObject_Sound::{ctor}' : constructors not allowed a return type[/code]
I don't know why it is thinking I am trying to return something in my constructor, because I am obviously not.
Please forgive me if the class is a horrible abomination: I am going off a somewhat-confusing tutorial's example, and I have absolutely no idea what to do with the SoundBuffer, as explained early. A friend of mine suggested to use a pointer (*), but he admitted he's rusty on C++ and isn't sure.
Any help for either of these issues would be greatly appreciated.
Rather than creating a new managerobject_sound for each buffer, you may want to create a vector.
So rather than sf::buffer* you would have
[code]
std::vector<sf::buffer> buffer;
[/code]
Then setup a function like.
[code]
void addToBuffer(sf::buffer addBuffer)
{
buffer.push_back(addBuffer);
}
[/code]
What this does is rather than creating an array of thirty objects, it creates a vector that can be expanded as needed rather than initializing every buffer before its even needed. You can also check if an existing buffer of that type is already in the vector as well.
You may want to check with someone smarter than me though.
Interesting idea. I'll be sure to look into vectors, and what exactly they are and how they work. Thanks for the suggestion.
Any other ideas are welcome, of course. [img]http://dl.dropbox.com/u/8416055/FacepunchEmots/Buddy.gif[/img]
So, I am trying to solve a sprite layering issue in XNA 4.0
I decided the best method of approaching my issue is putting all the instances of the "Window" class in a list called "WindowList" this is to make the layering work properly so that clicking a window will bring it forth. I use an insertion sort loop to put them all in order in the list to draw the deepest one first, and then drawing the second deepest and so on. The problem is that the draw order seems completly fucked in this case. It's pretty much random with both layering and detection of where I click
[code] public void SortWindows()
{
for (int i = 1; i < WindowList.Count; i++)
{
for (int j = i; j > 0; j--)
{
if (WindowList[j].WindowLayerDepth > WindowList[j - 1].WindowLayerDepth)
{
AttractionWindow tmp = WindowList[j - 1];
WindowList[j - 1] = WindowList[j];
WindowList[j] = tmp;
}
else
break;
}
}
}[/code]
Is in the Game1 class, calls every loop, will change to only call when needed.
[code]protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.Black);
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
for (int i = 0; i < WindowList.Count; i++)
{
WindowList[i].Draw(spriteBatch);
}
spriteBatch.End();
base.Draw(gameTime);
}[/code]
and here's the click detection code
[code]if (CurrentmouseState.LeftButton == ButtonState.Pressed && OldMouseState.LeftButton == ButtonState.Released)
{
bool Invalid = false;
int ExcludeWindow = 0;
for (int i = 0; i < main.WindowList.Count; i++)
{
if (main.WindowList[i].rectangle.Intersects(rectanglePoint) && main.WindowList[i].TopWindow == true)
{
Invalid = true;
break;
}
}
if (!Invalid)
{
for (int i = 0; i < main.WindowList.Count; i++)
{
if (main.WindowList[i].rectangle.Intersects(rectanglePoint))
{
main.WindowList[i].surfaceWindow();
main.WindowList[i].TopWindow = true;
ExcludeWindow = i;
break;
}
}
{
for (int i = 0; i < main.WindowList.Count; i++)
{
if (i != ExcludeWindow)
{
main.WindowList[i].TopWindow = false;
}
}
}
}
}[/code]
so... I have a file I need to decompress
[url]http://dl.dropbox.com/u/1032139/token[/url]
I know it's compressed using some method, I was assuming zlib but nothing seemed to work. am I missing something, is there some tell-tale way to work out what way it's compressed or am I out of luck.
I need real quick way to write symbol-by-symbol to the console.
putchar() takes shameful amount of time to fill 80*50.
I don't really care how hacky it will be, speed is what matters.
Oh also, that is, in C++.
Curses?
[QUOTE=Gmod4ever;35819192]Interesting idea. I'll be sure to look into vectors, and what exactly they are and how they work. Thanks for the suggestion.
Any other ideas are welcome, of course. [img]http://dl.dropbox.com/u/8416055/FacepunchEmots/Buddy.gif[/img][/QUOTE]
Vectors are fantastic. They're STL containers (standard template library).
Templates basically mean that you can define one class or function, use templates and every time you invoke it, you can set the data type it will handle. That's why when darkrei9n did
[cpp]std::vector<sf::SoundBuffer> buffer;[/cpp]
You see the SoundBuffer in the angle brackets; that's instantiating a vector container that stores objects of type SoundBuffer. Which is, from what I gather, what you want to do.
[cpp]import pyglet
from pyglet.gl import *
import math
class Camera(object):
def __init__(self):
self.x = 0
self.y = 0
self.z = 0
self.rotx = 0
self.roty = 0
self.rotz = 0
class Game(pyglet.window.Window):
def __init__(self):
super(Game, self).__init__()
self.setupViewport(60, 0.1, 1000)
glEnable(GL_POINT_SMOOTH)
glPointSize(2.0)
def on_draw(self):
glLoadIdentity()
gluLookAt(0,0,-10,0,0,0,0,1,0)
glBegin(GL_POINTS)
glColor3f(1.0,0,0)
glVertex3f(0,0,0)
glEnd()
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT)
self.clear()
def drawCube(self, x, y, width, height, style):
glBegin(GL_QUADS)
glColor3f(1.0,0,0)
glVertex3f(-1.0,-1.0,0) # TL
glVertex3f(-1.0,-1.0,-1.0) # TLB
glVertex3f(1.0,-1.0,0) # TR
glVertex3f(1.0,-1.0,-1.0) # TRB
glColor3f(0,1.0,0)
glVertex3f(-1.0,-1.0,-1.0) # BTL
glVertex3f(1.0,-1.0,-1.0) # BTR
glVertex3f(1.0,1.0,-1.0) # BBR
glVertex3f(-1.0,1.0,-1.0) # BBL
glEnd()
def setupViewport(self, fov, nearclip, farclip):
aspect = self.width / self.height
glViewport(0,0,self.width,self.height)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
gluPerspective(80,aspect,nearclip,farclip)
glMatrixMode(GL_MODELVIEW)
g = Game()
pyglet.app.run()[/cpp]
It worked fine with a plain old orthographic projection matrix but now that I've switched it to perspective I can't see anything, it's driving me mad.
[b]Never mind I fixed it, had to override the on_resize event[/b]
Sorry, you need to Log In to post a reply to this thread.