Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Steampunk Mario
Aug 12, 2004

DIAGNOSIS ACQUIRED

tyrelhill posted:

position += velocity * deltaTime

In his case, velocity is a scalar, so he needs to use the direction (slope in this case) as well. It's just a case of dividing where he needs to multiply, as far as I can tell.

Adbot
ADBOT LOVES YOU

heeen
May 14, 2005

CAT NEVER STOPS
OpenGL/GPU question:
Can I use different filtering for the same texture in the same Scene? does changing the filtering on a texture require a pipeline flush?
As I understand it filtering is done on the TMU, so when I change the filtering on the TMU, this would require all triangles currently in the pipeline for this TMU to be finished first before the new filtering can be applied to new triangles, right?

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!
Pixel Shader question:

Much like, *ahem* Girl With Huge Tits, I'm starting to learn about doing some HLSL pixel shaders. It's pretty obvious to me how to do things like change the tone of an image, or do some distortion based on a function. I'm even thinking I'm starting to understand how to do normal maps and render to backbuffers. I'm pretty proud of even the simple shaders I've written (woo! Go Sepia!), but I want to start learning about more dynamic effects.

Things like fire perturbation (ie, the heat haze) really confound me. Web resources are surprisingly slim on how to set this up (or I suck at google.) Things like explosions are a little bit more documented, and I think I could implement one if I had to.

I should note that all of these effects are 2D, our game dev club has basically finished our engine, and we're looking to add some extra visual effects.

Does anyone have any resources? Good suggestions for books even?

heeen
May 14, 2005

CAT NEVER STOPS

Pfhreak posted:

heat haze

Heat haze is a very simple effect, really. All you need is the current scene in a back buffer, which you perturbate either by using some sine/cosine or whatever function, or you get the distortion by overlaying some textures and using the resulting color as the distortion vector.
Additionally you can throw the distance into the mix, to modify the strength of the effect in the distance.
I implemented it as a post processing effect, rendering the whole scene into a buffer, then rendering one quad for the whole scene with the heat haze shader applied.

GLSL code follows:
code:
(...)
	//heat haze
	if (w_temperature > heatHazeLimit){
		strength = (w_temperature - heatHazeLimit) * 0.0002;
		distort = texture2D(heat, pos * 10.0 + vec2(time, -time)).rg * 2.0 - 1.0;
		distort += texture2D(heat, pos * 10.0 + vec2(-time, -time)).rg * 2.0 - 1.0;
		offset = distort * depthval * depthval * strength;
	} else {
		offset = vec2(0.0, 0.0);
	}

	col = texture2D(screen, pos + offset);
(...)
I suggest you check out the ATI Rendermonkey SDK, it contains many examples of shaders for you to play around with.

IcePotato
Dec 29, 2003

There was nothing to fear
Nothing to fear

Drx Capio posted:

In his case, velocity is a scalar, so he needs to use the direction (slope in this case) as well. It's just a case of dividing where he needs to multiply, as far as I can tell.

Thanks guys. Unfortunately while waiting for an answer I decided to do some more work on my main loop and broke the display code, so I can't tell if it works or not anymore :downs:

Ferg
May 6, 2007

Lipstick Apathy
Does anybody know of a reasonable way to get music into an XNA game? I just found out yesterday that XACT only supports WAV files and making an entire song in uncompressed WAV is just not going to cut it.

Hubis
May 18, 2003

Boy, I wish we had one of those doomsday machines...

heeen posted:

OpenGL/GPU question:
Can I use different filtering for the same texture in the same Scene? does changing the filtering on a texture require a pipeline flush?
As I understand it filtering is done on the TMU, so when I change the filtering on the TMU, this would require all triangles currently in the pipeline for this TMU to be finished first before the new filtering can be applied to new triangles, right?

As I understand it, yes that would insert a bubble into the pipeline.

Cedra
Jul 23, 2007

stromdotcom posted:

I've only glanced briefly at it, but this looks good: http://www.kersson.com/articles/article.aspx?ar=41

Thanks very much! I'm slowly going through it, trying to understand the reasonings behind the code (something I find lots of tutorials lack - they just lead you with little explanation as to why they're doing it). Halfway through this page, I don't get what this is snippet from the TileSet class is supposed to do:
code:
public Rectangle Rectangle(int position)
{
 return rectangles[((position-1) / columns), ((position - 1) % columns)];
}
From what I'm reading, it's to find a specific tile? But let's use the example image he has provided. He's labelled the 6 tiles as

123
456

So let's place the number 6 as the position parameter, and columns 3. rectangles would come out as [2 (or 1.67 rounded up),2], which I think would take tile 9, no?? (this is C# btw)

Jake Armitage
Dec 11, 2004

+69 Pimp

Ferg posted:

Does anybody know of a reasonable way to get music into an XNA game? I just found out yesterday that XACT only supports WAV files and making an entire song in uncompressed WAV is just not going to cut it.

XACT allows you to compress your audio files (see this)

Unless the XNA implementation of the audio engine specifically doesn't support compressed audio, which I haven't heard, and which would surprise me.

[edit] Indeed it does. Because msdn can be a bit dry, have a look at this

Jake Armitage fucked around with this message at 21:54 on Mar 25, 2008

ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender

Cedra posted:

1.67 rounded up

Integer arithmetic does not round, it truncates. 5 / 3 = 1.

Ferg
May 6, 2007

Lipstick Apathy

stromdotcom posted:

XACT allows you to compress your audio files (see this)

Unless the XNA implementation of the audio engine specifically doesn't support compressed audio, which I haven't heard, and which would surprise me.

[edit] Indeed it does. Because msdn can be a bit dry, have a look at this

Awesome, thanks for the pointer.

On another note with XNA, can somebody dumb down a good program design for dealing with multiple game states? I downloaded the GameStateManagement example from the Creators Club and while it nails exactly what I'm trying to learn, the thing is an absolute behemoth and it'd be a huge help if anybody could explain just whats going on in there so I can start making sense of it all. I've been working on a sort of retro remake of Space Invaders to freshen up on my XNA skills and I'm finding that moving between menus and such is a bit more tricky than I anticipated.

Edit: One more question to throw into the mix. I passed along a Windows build of my game to a friend who doesn't have a Creators Club membership and he would have an exception thrown whenever trying to log onto Live with his account through my game. What's the story with that? Will non-Creators Club members be able to use the Live interface once Community Games goes live? Is there a workaround to allow non-members Live access?

Ferg fucked around with this message at 22:52 on Mar 25, 2008

Cedra
Jul 23, 2007

ShoulderDaemon posted:

Integer arithmetic does not round, it truncates. 5 / 3 = 1.

Right, right. That makes sense, thanks.

Jake Armitage
Dec 11, 2004

+69 Pimp

Ferg posted:

On another note with XNA, can somebody dumb down a good program design for dealing with multiple game states? I downloaded the GameStateManagement example from the Creators Club and while it nails exactly what I'm trying to learn, the thing is an absolute behemoth and it'd be a huge help if anybody could explain just whats going on in there so I can start making sense of it all.

I wrote something really brief about it here, and Microsoft's Nazeeh wrote more on it here

Honestly though, the best way to figure it out is just to dig into it and start messing with it. It's not nearly as complicated as it looks. Whatever you want to add or modify is probably in there. For example, if you wanted to add a game over screen, you'd probably scale down the GameplayScreen or scale up the BackgroundScreen. If you open up the GameplayScreen.cs file and start trying to add your game logic to it, you'll pretty quickly figure out what needs adjusting to make it work.

Ferg
May 6, 2007

Lipstick Apathy

stromdotcom posted:

I wrote something really brief about it here, and Microsoft's Nazeeh wrote more on it here

Honestly though, the best way to figure it out is just to dig into it and start messing with it. It's not nearly as complicated as it looks. Whatever you want to add or modify is probably in there. For example, if you wanted to add a game over screen, you'd probably scale down the GameplayScreen or scale up the BackgroundScreen. If you open up the GameplayScreen.cs file and start trying to add your game logic to it, you'll pretty quickly figure out what needs adjusting to make it work.

Awesome, these links are exactly what I was looking for. Thanks!

Yeah I had been poking around in the example but they take one too many big ideas for me to quite digest it at this point in my XNA expertise.

Femtosecond
Aug 2, 2003

I really want to get off my rear end and start programming some games, but I'm so conflicted about whether I want to A) get something up and running quickly and easily via XNA or B) go the more complex route and do something that I can later port to (or develop on) both platforms. I have a Macbook Pro, and I sort of want to maybe make something that can be on the Mac as well, but at the same time I feel that that would be much more complex with having to know about making interfaces for both Windows and OS X and as well having to deal with a less user friendly library (SDL most likely). I'm not sure what I should do.

I'm fully ok with working and using a PC so maybe I should at least do something in XNA, if only to get my feet wet. I just need to make a decision and get started on something. With XNA I feel like I could get something running now, but with something like SDL, there are more options, but I think I'd have to do a lot more learning and setup to get into the flow of it. Gah I don't know what I should do.

IcePotato
Dec 29, 2003

There was nothing to fear
Nothing to fear

Femtosecond posted:

I really want to get off my rear end and start programming some games, but I'm so conflicted about whether I want to A) get something up and running quickly and easily via XNA or B) go the more complex route and do something that I can later port to (or develop on) both platforms.

Start simple. Trust me on this one. Use XNA, make a really simple 2d platforming game or whatever, and make lots of mistakes.

Ferg
May 6, 2007

Lipstick Apathy

IcePotato posted:

Start simple. Trust me on this one. Use XNA, make a really simple 2d platforming game or whatever, and make lots of mistakes.

I can vouch for this. Like I mentioned before I'm working on a space invaders clone just to familiarize myself with XNA. Starting with no experience in XNA at all I whipped up a working game in 2 days. Now I'm learning the ins and outs by cleaning up the code and messing around with stuff.

Jake Armitage
Dec 11, 2004

+69 Pimp

Femtosecond posted:

With XNA I feel like I could get something running now, but with something like SDL, there are more options

I'm agreeing with IcePotato and Ferg that you should definitely go the XNA route, even if just to drastically improve your chances of actually finishing a game. But if it helps you, a lot of people are using XNA to prototype games that they'll eventually do on some other platform. So either way, you don't lose anything by starting with XNA.

king_kilr
May 25, 2007
Does anyone have any recommendations as to where to find decent sprite images?

SnakeByte
Mar 20, 2004
FUCK THIS COMPANY THAT HASNT PRODUCED THE GAME IN QUESTION FOR YEARS BECAUSE THEY SUSPENDED ME FOR EXPLOITING A BUG FUCK THEM IN THE ASS I AM A MORON

king_kilr posted:

Does anyone have any recommendations as to where to find decent sprite images?

http://www.gamedev.net/community/forums/topic.asp?topic_id=272386

Here you go. :]

minidracula
Dec 22, 2007

boo woo boo

Femtosecond posted:

I really want to get off my rear end and start programming some games, but I'm so conflicted about whether I want to A) get something up and running quickly and easily via XNA or B) go the more complex route and do something that I can later port to (or develop on) both platforms. I have a Macbook Pro, and I sort of want to maybe make something that can be on the Mac as well, but at the same time I feel that that would be much more complex with having to know about making interfaces for both Windows and OS X and as well having to deal with a less user friendly library (SDL most likely). I'm not sure what I should do.

I'm fully ok with working and using a PC so maybe I should at least do something in XNA, if only to get my feet wet. I just need to make a decision and get started on something. With XNA I feel like I could get something running now, but with something like SDL, there are more options, but I think I'd have to do a lot more learning and setup to get into the flow of it. Gah I don't know what I should do.

I'm not joking when I say you should check out BlitzMax. Cross-platform, fast, game-focused, and easy. But, unlike XNA, it's not free, though it is inexpensive given what it gives you. If you were going for something heavily 3D, then I might suggest otherwise (Blitz3D is available from the same company, though it's not cross-platform like BlitzMax), but there's an independently developed free 3D engine, MiniB3D, which is pretty awesome. I'm not sure yet how suitable it is for heavily 3D games; it might be more than enough.

My bias: I bought both Game Maker and BlitzMax (with the MaxGUI add-on module) since cost was low, and the roundtrip time from idea to proof of concept to playable game is really short. I know how to program, but I wanted something focused and self-contained to start with, just so I can focus on experimenting and making games and not futzing with the technology.

Twerpling
Oct 12, 2005
The Funambulist
Anyone know of the best way to implement a good FSM in C#? I am trying to make one for an XNA game I am working on but the one I always use I made in C++ and it falls apart in C# due to delegates not working the same a function pointers. If I work on this bloody thing long enough I'm sure I'll get it, but I was hoping someone would have an example of a good one already done so I can work this out faster.

iopred
Aug 14, 2005

Heli Attack!

Twerpling posted:

Anyone know of the best way to implement a good FSM in C#? I am trying to make one for an XNA game I am working on but the one I always use I made in C++ and it falls apart in C# due to delegates not working the same a function pointers. If I work on this bloody thing long enough I'm sure I'll get it, but I was hoping someone would have an example of a good one already done so I can work this out faster.

FSM's can be made pretty easily in a nice OOP way, create a State interface, with methods like "Start, Run and End" and then just have a FSM class that does all the transitions by calling the right functions. Then its just an issue of making a bunch of different classes to do the things you want.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!

iopred posted:

FSM's can be made pretty easily in a nice OOP way, create a State interface, with methods like "Start, Run and End" and then just have a FSM class that does all the transitions by calling the right functions. Then its just an issue of making a bunch of different classes to do the things you want.

To be entirely correct, you should probably make a state abstract base class rather than a state interface. (Remember, C# has an interface keyword.)

There are a number of advantages to doing this, one, your states are all going to be like objects with a common type, not dissimilar objects with a common type. Two, you'll be able to create default methods for things like OnEnter, and OnExit, (heck, even Update and Draw) and it will make your concrete states that much cleaner to look at.

iopred
Aug 14, 2005

Heli Attack!

Pfhreak posted:

To be entirely correct, you should probably make a state abstract base class rather than a state interface. (Remember, C# has an interface keyword.)

There are a number of advantages to doing this, one, your states are all going to be like objects with a common type, not dissimilar objects with a common type. Two, you'll be able to create default methods for things like OnEnter, and OnExit, (heck, even Update and Draw) and it will make your concrete states that much cleaner to look at.

Ah, my bad, I'm not a C# programmer, we don't have thems fancy abstract classes in AS3.

newsomnuke
Feb 25, 2007

I'm writing a rather specific fragment shader (GLSL but can change to Cg if necessary). I'm hoping to use it to doing picking. Every polygon to be rendered has a unique colour to identify it, and I pass the current mouse position into the shader using uniforms. Thus, in the shader, I can test whether the mouse position is the same as the fragment position, and if it is, I know the mouse is over whichever polygon is signified by the colour.

So the shader knows which polygon is selected, but how do I get this information back to the actual program?

haveblue
Aug 15, 2005



Toilet Rascal

ultra-inquisitor posted:

So the shader knows which polygon is selected, but how do I get this information back to the actual program?

Try using GL's selection mode instead of a shader; it's made for that sort of thing.

If you can't do that, you'll have to copy the framebuffer back to main memory with glReadPixels to inspect it.

newsomnuke
Feb 25, 2007

HB posted:

Try using GL's selection mode instead of a shader; it's made for that sort of thing.

If you can't do that, you'll have to copy the framebuffer back to main memory with glReadPixels to inspect it.
My engine is 2D and uses lots of semi-transparent textures - AFAIK selection mode just tests geometry, not at the pixel level, so I would get lots of false positives.

I'm trying to avoid rendering to a target and reading from that because it's really slow.

Hubis
May 18, 2003

Boy, I wish we had one of those doomsday machines...

ultra-inquisitor posted:

I'm writing a rather specific fragment shader (GLSL but can change to Cg if necessary). I'm hoping to use it to doing picking. Every polygon to be rendered has a unique colour to identify it, and I pass the current mouse position into the shader using uniforms. Thus, in the shader, I can test whether the mouse position is the same as the fragment position, and if it is, I know the mouse is over whichever polygon is signified by the colour.

So the shader knows which polygon is selected, but how do I get this information back to the actual program?

You could use the ARB_occlusion_query extension to get the number of fragments generated that overlap your cursor area. Basically, what you'd do is render each selectable object (wrapped with an occlusion query set/retrieve pair) and have a shader that renders some value (it doesn't matter what) if the cursor overlaps the fragment, or discards the fragment otherwise.

It won't be the swiftest thing in the world, but it would be a lot faster than reading back and parsing framebuffer data from the card.

Gary the Llama
Mar 16, 2007
SHIGERU MIYAMOTO IS MY ILLEGITIMATE FATHER!!!
Can someone explain why the NeHe OpenGL tutorials are considered to be crappy? I've stuck with DirectX all this time because I've heard his tutorials are crap, but I'd really like to do cross platform development. So why exactly are his tutorials so bad?

And how should I go about learning OpenGL? (Note: This will mainly be for doing 2D games.) The red/blue books are just daunting when I crack 'em open at the bookstore. :(

Ghost of Reagan Past
Oct 7, 2003

rock and roll fun
A friend and I made a card game that we're looking to implement in a computer game, and we're trying to find some direction. I know C# and C++ (and I could probably do Java in a pinch), but I'm really looking for a near-prefab solution to developing card games on the PC. I've found a few things, but none are really working all that well. Thoth isn't powerful enough to do what we want (not joking), and the Card Game Starter Kit that Microsoft provides is totally useless for developing something like this.

I'm really not knowing where to start here. Any tips? I don't need much for graphics, obviously.

Ghost of Reagan Past fucked around with this message at 07:11 on Apr 3, 2008

Gary the Llama
Mar 16, 2007
SHIGERU MIYAMOTO IS MY ILLEGITIMATE FATHER!!!

Euphoria 5L posted:

A friend and I made a card game that we're looking to implement in a computer game, and we're trying to find some direction. I know C# and C++ (and I could probably do Java in a pinch), but I'm really looking for a near-prefab solution to developing card games on the PC. I've found a few things, but none are really working all that well. Thoth isn't powerful enough to do what we want (not joking), and the Card Game Starter Kit that Microsoft provides is totally useless for developing something like this.

I'm really not knowing where to start here. Any tips? I don't need much for graphics, obviously.

I developed a little card/memory game in BlitzBasic with relative ease. There's also DarkBasic. Either one of those would (at the very least) work for a quick prototype.

newsomnuke
Feb 25, 2007

Nuke Mexico posted:

You could use the ARB_occlusion_query extension to get the number of fragments generated that overlap your cursor area. Basically, what you'd do is render each selectable object (wrapped with an occlusion query set/retrieve pair) and have a shader that renders some value (it doesn't matter what) if the cursor overlaps the fragment, or discards the fragment otherwise.
That doesn't really solve the problem, but thanks for bringing up occlusion queries because I think I can use them for something else. I think I may just have to read back from the buffer a few frames late, which should give the GPU time to finish rendering.

pianoSpleen
Jun 13, 2007
printf("Java is for programmers with no %socks", "c");

Gary the Llama posted:

Can someone explain why the NeHe OpenGL tutorials are considered to be crappy? I've stuck with DirectX all this time because I've heard his tutorials are crap, but I'd really like to do cross platform development. So why exactly are his tutorials so bad?

And how should I go about learning OpenGL? (Note: This will mainly be for doing 2D games.) The red/blue books are just daunting when I crack 'em open at the bookstore. :(

A lot of stuff is really poorly explained and there's no logical progression to the tutorials past the first few. There wasn't, for example, a useful tutorial about things like vectors/matrices. Instead there was suddenly some fancy effect that needed an understanding of them and almost no explanation of what was going on that someone who didn't have an understanding of vectors would be able to make sense of. To be honest, past about tutorial 20 it's more like a parade of demos combined with "Look at me! I can prove I wrote it!" than an attempt to teach you what you need to know.

Also almost all the tutorials are written in straight C and very poorly organised. You cannot write code like that in a real game - game engines are large things and need reasonably good design. Some of the techniques are also largely obsolete and a lot of important stuff (mostly the stuff that can't be used to make a prettier demo) isn't covered.

//Every Single Comment In Every Single Program Is Written Like This For Some Reason, Which As You Can See Is Not Only Unbelievably Obnoxious But Is Also A Neat Hint As To When People Have Copy-Pasted From That Site.

I kept an old version of my first serious attempt at writing a game around purely so I can scare people off NeHe tutorials and Sams books for life. I'll have to dig it up and post it sometime, there's comedy gold in there.

The Red Book is DEFINITELY worth buying as a reference, but it's a bit too heavy for learning the basics. If you have a half-decent DirectX background you'll find a lot of the concepts map to OpenGL quite easily.

Ages ago someone gave me a GameTutorials CD; I skimmed over some of it and it looks a lot better than NeHe's stuff - one of the most complex tutorials has a full BSP renderer, lightmaps, collision detection and all. They cost money though, so I'd wait for someone else to look through it properly before putting down cash.

pianoSpleen fucked around with this message at 09:42 on Apr 6, 2008

PnP Bios
Oct 24, 2005
optional; no images are allowed, only text

pianoSpleen posted:

A lot of stuff is really poorly explained and there's no logical progression to the tutorials past the first few. There wasn't, for example, a useful tutorial about things like vectors/matrices. Instead there was suddenly some fancy effect that needed an understanding of them and almost no explanation of what was going on that someone who didn't have an understanding of vectors would be able to make sense of. To be honest, past about tutorial 20 it's more like a parade of demos combined with "Look at me! I can prove I wrote it!" than an attempt to teach you what you need to know.

Also almost all the tutorials are written in straight C and very poorly organised. You cannot write code like that in a real game - game engines are large things and need reasonably good design. Some of the techniques are also largely obsolete and a lot of important stuff (mostly the stuff that can't be used to make a prettier demo) isn't covered.

//Every Single Comment In Every Single Program Is Written Like This For Some Reason, Which As You Can See Is Not Only Unbelievably Obnoxious But Is Also A Neat Hint As To When People Have Copy-Pasted From That Site.

I kept an old version of my first serious attempt at writing a game around purely so I can scare people off NeHe tutorials and Sams books for life. I'll have to dig it up and post it sometime, there's comedy gold in there.

The Red Book is DEFINITELY worth buying as a reference, but it's a bit too heavy for learning the basics. If you have a half-decent DirectX background you'll find a lot of the concepts map to OpenGL quite easily.

Ages ago someone gave me a GameTutorials CD; I skimmed over some of it and it looks a lot better than NeHe's stuff - one of the most complex tutorials has a full BSP renderer, lightmaps, collision detection and all. They cost money though, so I'd wait for someone else to look through it properly before putting down cash.

Game Tutorials is crap, at least when they were free it was. It just gives you a folder full of source files, with no clear reading direction, and the 'tutorial' was comments in the source. I would definitely recommend not spending money on them.

Smegbot
Jul 13, 2006

Mon the Biffy!
The main problem with NeHe is that it's seen as the definitive resource for learning OpenGL yet the guy behind them is, to use his own words, an "average programmer with average skill". They're worth reading but don't use them alone.

Some resources you might find helpful:

This is a complete, online copy of the red book. It's not the newest revision but it's useful until you decide you wanna buy a copy.

Nate Robins tutorials are worth a look. Probably more useful for seeing what different things do in action than as programming tutorials.

Lighthouse3d has a bunch of tutorials from their own and other sites.

There isn't really a website (that I've found anyway) that gives a set course of tutorials to the extent of NeHe. Maybe following them with reference to other individual tutorials would be your best bet.

samiamwork
Dec 23, 2006
I'm rendering some junk to an FBO and I'd like to read the texture out into main memory with glGetTexImage. Unfortunately I'm getting "invalid enumerant" errors and it's driving me crazy. Does anyone have any idea what's wrong?

I create the texture like this:
code:
glGenTextures(1, &tex->id);
glBindTexture(tex->target, tex->id);
glTexParameteri(tex->target, GL_TEXTURE_STORAGE_HINT_APPLE,
        GL_STORAGE_CACHED_APPLE);
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
glTexImage2D( tex->target, 0, GL_RGBA, tex->width, tex->height, 0, GL_BGRA,
	 GL_UNSIGNED_INT_8_8_8_8_REV, (const void*)tex->data);

GLenum status = glGetError();
if( status != GL_NO_ERROR )
	printf("error uploading texture: %s\n", gluErrorString(status));
and I try to read it out like this:
code:
glBindTexture( tex->target, tex->id );
glGetTexImage(tex->target, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, data);
GLenum status = glGetError();
if( status != GL_NO_ERROR )
	printf("error downloading texture: %s\n", gluErrorString(status));
The "tex" struct members should be straightforward enough I hope.
The target is exactly the same (I've checked). "Format" and "Type" are also the same as you can see. I really don't see why I should be getting an "invalid enumerant" error. I can post more code if it's needed.

edit: For whatever reason it's working now. I guess the problem was somewhere else. I only wish I knew how I fixed it.

samiamwork fucked around with this message at 03:26 on Apr 7, 2008

pianoSpleen
Jun 13, 2007
printf("Java is for programmers with no %socks", "c");

PnP Bios posted:

Game Tutorials is crap, at least when they were free it was. It just gives you a folder full of source files, with no clear reading direction, and the 'tutorial' was comments in the source. I would definitely recommend not spending money on them.

Ah, okay, fair enough (I kind of assumed I'd just missed the documenting files).

Out of curiosity, does anyone have any experience with third-party books on the subject? Like O'Reilly and such.

vanjalolz
Oct 31, 2006

Ha Ha Ha HaHa Ha
I once read a book by Andre LaMothe: Tricks of the windows game programming gurus.

I loved it, but its a bit old now (directdraw 5 is used, along with some other out dated interfaces...). Still, it's a good introduction to how to think like a games programmer, and how to structure your code. There was meant to be a 3D version of the book (part 2 if you will) but I never found it...

Adbot
ADBOT LOVES YOU

Ferg
May 6, 2007

Lipstick Apathy
Alright I've got yet another licensing question. I decided to utilize the GameStateManagement example that's provided on the XNA website as a framework for my game's state management. I've basically plugged my game into the GameplayScreen object, and tweaked the hell out of every other screen (removed some, tweaked others). But lets say down the line I want to distribute my game. What obligations do I have as far as licensing for these huge chunks of code that I used from Microsoft? Can I just keep the MS branding at the top and add my licensing as well? Can I license it with my own license at all?

I'd say with all the code added from the example it's a good 15%-20% of the game right now is code that I didn't entirely write, and I'd like to submit this to community games come winter.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply