• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
sparksterz

Bitmap loading

9 posts in this topic

I have been following along with the code for the particle system in lesson 19 on the site and it seems very useful. However I do not understand how to get the code to work for loading a texture. The code in there is rather outdated and I'm using Visual Studio 2008. I'm pretty new to C++ but have worked in C# so the pointers and handles that exist are kind of throwing me for a loop. I understand what it is trying to do due to the excellent documentation, but I still can't figure it out myself. For example AUX_RGBImageRec *LoadBMP(char *Filename){...} Is supposedly a function which checks to see if there is a bitmap it can load. However AUX_RGBImageRec is not an object type I've ever heard of... and to give it a pointer as a function name confuses me. Is there a more recent way to import textures into OpenGL? My teacher has not covered it yet as we are still on lighting. Thanks for the help!
0

Share this post


Link to post
Share on other sites
AUX_RGBImageRec is part of the glaux library which is now obsolete and probably shouldn't be used.


Quote:

AUX_RGBImageRec *LoadBMP(char *Filename){...} Is supposedly a function which checks to see if there is a bitmap it can load. However AUX_RGBImageRec is not an object type I've ever heard of... and to give it a pointer as a function name confuses me.




You're not giving AUX_RGBImageRec a pointer as a function type, LoadBMP is returning a pointer of type AUX_RGBImageRec. In the indirection operator (*) position doesn't effect it's association (int *a; is the same as int* a;). LoadBMP creates the AUX_RGBImageRec structure in memory and assuming there are no errors, populates it with data from the BMP at the path you specified. LoadBMP then returns a pointer of type AUX_RGBImageRec which contains the location in memory where LoadBMP stored the bitmap data (which is in the format described by the AUX_RGBImageRec structure).

You may have more luck moving ahead to Lesson 33 and doing TGA texture loading. At least it avoids glaux and it can be adapted to loading BMPs as well.


You might also consider reading the OpenGL Red Book(which is available for free) instead of the NEHE tutorials.


Anyway I hope this helps. :)

[Edited by - prh99 on April 4, 2009 2:32:08 PM]
0

Share this post


Link to post
Share on other sites
Well, we have gone over in class how to read in our own textures and now I am trying to apply that to some what the program covers, right now it handles the eruption great as long as I keep it in an infinite loop which then gives me a stack overflow (due to myself being unsure as to when to garbage collect which is a whole other issue in itself).
So I'm trying to apply the texture to each particle once in my "initializeParticleSystem()" method however I have not been able to get it to work well. Some of my other class mates suggested that I try messing around with some of my texture blending calls as I'm trying to use color to augment the texture where as currently it is replacing the color (ie. the texture isn't visible, only a solid color) So I will mess around with it and let people know what I find.
0

Share this post


Link to post
Share on other sites
After working on this for a couple of hours again it seems the more pressing issue is trying to find a way to tell my particle system to loop so that it keeps flowing. It seems I can't create a loop function to do this because I'm also looking to take in keyboard input and the only way I've been able to get the particle system to display is if I lock the display system in a loop. Once I hand off control to glutMainLoop() it seems it's over. I'm trying to create a more friendly version of the particle system that exists where I'm not calling anything outdated or using the windows API.

Essentially I have a main() like this

initParticleSys();
glutDisplayFunc( display ); //sets up a pair of axes and other stuff
glutReshapeFunc( reshape );
glutKeyboardFunc( keyboard ); //looks for keyboard input
while( erupt == true)
drawExplosion();
glutMainLoop();

Thing is I can never see my result because I can't get it to glutMainLoop(), and as soon as I do, I can't keep the particle system going...Anyone have any advice for me to try? I will be seeing my teacher tomorrow about this, and I'll let you know what he tells me.
0

Share this post


Link to post
Share on other sites
Well it seems that you need some info on how GLUT works.

If you call glutMainLoop() it just executes your drawing callback (called display() ).
GLUT will not update itself unless you add a "glutPostRedisplay()" either at the end of the display() method or add an glutIdleFunc. This request for a redisplay causes a call of display(), and if you do this all the time you'll get what you want, being a real animation.

Another thing to note is that many simple GLUT apps do not enable double buffering which might cause some flickering. Look at glutInitWindow() or so where you might have GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE. If you find GLUT_SINGLE here, then you're on a single buffered system which is the setup which might not look as good as a double buffered one.
So change GLUT_SINGLE to GLUT_DOUBLE and add glutSwapBuffers() at the end of your display() method instead of glFlush()

Hope that helps for now [smile]
0

Share this post


Link to post
Share on other sites
Thanks Caste, that seems to have done the trick. I'm going to spend some time now to try and get the textures to map onto the particle and react to color changes now. Currently whatever color I'm giving the textures is being drawn as a solid color and not reacting to any alpha values, it's most likely something in the way I set up my blending, I may have to try and set up GlTexEnv I'm not sure. But I have some nice values set which make the eruption kind of look like a fountain which is pretty neat.

I plan on making some user interaction perhaps by taking input through the console and parsing it or just using key press commands depending on how difficult it turns out to be. I'll let you know what I come up with.
0

Share this post


Link to post
Share on other sites
Checking for key input is really simple with GLUT:
-register a callback function for glutKeyboardFunc()
-implement a method with the type void myKeyCallback(char key, int x, int y) wich gives you the key as a char (so for instance check for key == 'a') and the mouse position when you hit this key.

And please tell ous about your results or add a screenshot [wink]
0

Share this post


Link to post
Share on other sites
The volcano is coming along very nicely. I had to present it in class today. I may have time to provide you guys with some pictures this weekend or even a video depending on how much time I get. Thanks for your support!
0

Share this post


Link to post
Share on other sites
Sorry again for the delay. I have put up 5 pictures of my volcano for you guys to look at. It turned out really nice. The only thing I would want to end up changing is making the textures read in the black areas of the particle as an alpha value. Which is something that could be done pretty easily but I didn't get done in time for me to present it to the class. Here is my photobucket album if you guys wish to look at the pictures!

http://s7.photobucket.com/albums/y256/12345SparksterZ/
0

Share this post


Link to post
Share on other sites
Looks cool! Adding blending would make it look way better though.

You'll have problems with blending if you don't sort your particles back to front and render without depth testing because otherwise a nearer particle (which should be transparent) hides the ones behind it if these are drawn afterwards.

http://www.opengl.org/wiki/Alpha_Blending
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0