Jump to content
  • Advertisement
Sign in to follow this  
Frenzy123

OpenGL C and GLUT

This topic is 3478 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, im in my final year of university(studying games programming) and for one of my projects i am trying to create a simple particle engine on the PS3 using GLUT to test performance with and without the SPE. My problem i have is C and GLUT related and it is probably worth mentioning that both were new to me a month or so back, although i have used OpenGL before(GL/GLU). I have a simple particle struct with variables for position and velocity etc, a particle system struct which holds a number of particles and finally main which calls the relative GLUT functions to setup a scene. I also have several functions which allow me to set the particles variables, update the particles and also render. Each of these functions takes a particle system pointer as a parameter. My problem is with the callback function, i have the usual display function which i want to render and update my particles but at the same time i dont want my initialisation in this function i need it in main. If i create the particle system in Main my display function isnt able to access it(which the render and update functions will need as a parameter) and if i create it in the display function then every time the callback is called a new particle system is created. Im new to C so there maybe be a very simple solution i have not thought of, i was thinking along the lines of making particle system static, but i will eventually need more than 1 particle system at a time. Any help is appreciated. Thx

Share this post


Link to post
Share on other sites
Advertisement
Yes, make your particle thing global, declare it at the top of your main.c file.
If you need more than 1, then just create more than 1.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!