• Advertisement

dreamslayerx

Member
  • Content count

    38
  • Joined

  • Last visited

Community Reputation

114 Neutral

About dreamslayerx

  • Rank
    Member
  1. c++ basics

    If you are going to start C++ this is a great sourced http://www.cplusplus.com/ .  I personally am a mathematician, and I got majority of my heavy programming from this source.  Do not be discouraged by the language.  It is very powerful and is great for object oriented programming which is a very big thing now a days.   http://www.cplusplus.com/   The above link has great tutorials and also reference guides.  This will not only allow you to know how to use the coding syntax, but understanding what is going on behind some of the functions or code within the library.  It will be a big help when you start to manipulate data more.
  2. OpenGL OpenGL Rendering over SDL

    Thanks for the advice.
  3. OpenGL OpenGL Rendering over SDL

    [quote name='Sponji' timestamp='1351671596' post='4995745'] [quote name='dreamslayerx' timestamp='1351605350' post='4995408'] I only want OpenGL to do rendering, but SDL to control sound and events. [/quote] That doesn't make much sense, what do you need GLUT then for? You can do the same OpenGL stuff with SDL, so why not just use it? [/quote] [quote name='AlexB.hpp' timestamp='1351675757' post='4995760'] [quote name='dreamslayerx' timestamp='1351605350' post='4995408'] SDL and glut conflicts, since they like to control the same things. [/quote] Exactly! It do the same thing. You have to chose one and use it... If you want to use glut so just find another one sound handler ie OpenAL. [/quote] That's very true. I wanted to explore the functionality of both, but for now I will only use SDL. I think SDL provides a more straight forward approach. I haven't been able to find a really good tutorial for OpenAL for beginners. I'm going to adjust the code later and see what you guys think about it. I am going to use only SDL in the first case. Also any advice on whether I should use SDL or glut/OpenAL? Which would be more practical for creating an rpg game?
  4. OpenGL OpenGL Rendering over SDL

    Here are the windows that I am getting. I have attached them a a file. I only want the opengl window, but I don't need the SDL App window to come up. The big issue is will I have to put my OpenGL rendering within the while(running = true) loop to just get it to render with the sound? I only want OpenGL to do rendering, but SDL to control sound and events. Is that possible? Currently the only thing that I want from SDL is Audio, but it wants to control video or a screen as well, even though I only use SDL_Init(SDL_INIT_AUDIO). I have already actually tried inputing SDL_SetVideoMode(640,480,32,SDL_OPENGL). SDL still wants to render a screen if I want to control my sound effect events. Here is the adjusted code for the main section of the program. I decided to move the sound function into the main program. There may be a better way of doing this though. SDL and glut conflicts, since they like to control the same things. Basically here SDL events can not even be controlled at all unless you first do SDL_SetVideoMode(). [source lang="java"]int main(int argc, char ** argv) { //SDL_Init(SDL_INIT_AUDIO); //Real program glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE| GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(500,500); glutCreateWindow("colorcube"); //Function that makes display list for the Terrain loadTerrain(); //Original Code //function added in to make display list for Geometry makeGeometry(); cout<<endl; cout<<" Elevation[1] : " <<Elevation[1]<<endl; //Place initialization function here initRendering(); //SOUND TESTING NEW // SDL_Sound(); //*********************************************************Big test: Delete all later************************************************************** SDL_Init(SDL_INIT_AUDIO); SDL_Surface *screen; //test screen = SDL_SetVideoMode(640, 480, 32, SDL_OPENGL); //test Mix_Chunk* effect1; //new varible to create effects from SDL lib Mix_Music* music; //used to create the music //Open Audio Mix_OpenAudio(22050, MIX_DEFAULT_FORMAT,2, 4096);//require 4 parameters ( references (default 22050 or 41000), format(how to open,number of channels , chunk size) //Loading Music music = Mix_LoadMUS("Train.wav"); //assigns music to load Mix_LoadMUS(filenam. filetype) //Assiging music to load effect1=Mix_LoadWAV("TrainHorn.wav"); //Playing the music Mix_PlayMusic(music,-1);//Telling program to play the music (play music file, how long to play 0 = play once, -1 = repeat, 1 = will repeat once) //now to control the effect when key is pressed bool running=true; //boolean expression to make true Uint32 start; SDL_Event event; while(running) { start=SDL_GetTicks(); SDL_Event event; while(SDL_PollEvent(&event)) { switch(event.type) { case SDL_QUIT: running=false; break; case SDL_KEYDOWN: switch(event.key.keysym.sym) { case SDLK_1: //number key 1 can be pressed Mix_PlayChannel(-1, effect1, 0);// there are a total of 8 channels (channel, effect to play, how to repeat) break; case SDLK_2: //number key 1 can be pressed running = false; break; } } glutReshapeFunc(myReshape); glutDisplayFunc(display); //glutIdleFunc(spinCube); glutMouseFunc(mouse); glutMainLoop(); // } }; //************************************************************************************************************************************************** //Section for deleting variable arrays to free up memory //These may be properly placed later; like in a new load clear function when putting in multiple geometry //Note** If I do not use display list to store the image and these are placed before the main loop the image will not show, since the stored data would be deleted on the second loop of main //This will be used to free up the memory so that I can read in another object using a function delete [] vertices; delete [] vertNorm; delete [] vertCoord; delete [] makePoint; delete [] texPoint; delete [] VNormPoint; //Original //glutMainLoop(); // anything placed after this will really not be read since it makes main loop until it comes back to this function then repeats //********************SOUND TEST AREA 2******************************************************************* //Deleteing variables recently created //Mix_FreeChunk(effect1); //Mix_FreeMusic(music); //Closing Audio Mix_CloseAudio(); SDL_Quit(); //**********************END SOUND TEST AREA 2********************************************************** return 0; }[/source]
  5. Hey guys. My problem may be pretty simple. I am writing some code for a world. I have it where opengl renders and sdl does everything else. The problem is that SDL wants to render before opengl, and if It doesn't create a screen I can't control my audio sound effect events. Does anyone know how to make SDL no render and give me only audio and controls with opengl doing the rendering thanks. I will attach the current code of the audio for sdl. The issue is that if I don't have SDL_Surface *screen; screen = SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE); uncommented out; I am not able to use my events. Worse it will not let opengl render over SDL. I will not let me upload the file so here is the code. [color=#0000cd]/*This program is a test program for using SDL Mixer to create sound in programs[/color] [color=#0000cd]Music and file loading on program works great. I just need to figure out how to control audio effect events without SDL needing to create a screen. I also need to put this into a function Note: The only issue with the program is that I can't controly my audio effect events unless I let SDL create a screen*/[/color] [color=#0000cd]#include <SDL/SDL.h> #include "SDL_mixer.h" //This include library directory may change on different machines[/color] [color=#0000cd]//SDL sound function void SDL_Sound() { SDL_Init(SDL_INIT_AUDIO); SDL_Surface *screen; //test screen = SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE); //test Mix_Chunk* effect1; //new varible to create effects from SDL lib Mix_Music* music; //used to create the music[/color] [color=#0000cd]//Open Audio Mix_OpenAudio(22050, MIX_DEFAULT_FORMAT,2, 4096);//require 4 parameters ( references (default 22050 or 41000), format(how to open,number of channels , chunk size)[/color] [color=#0000cd]//Loading Music music = Mix_LoadMUS("Train.wav"); //assigns music to load Mix_LoadMUS(filenam. filetype)[/color] [color=#0000cd]//Assiging music to load effect1=Mix_LoadWAV("TrainHorn.wav");[/color] [color=#0000cd]//Playing the music Mix_PlayMusic(music,-1);//Telling program to play the music (play music file, how long to play 0 = play once, -1 = repeat, 1 = will repeat once)[/color] [color=#0000cd]//now to control the effect when key is pressed bool running=true; //boolean expression to make true Uint32 start; //SDL_Event event; while(running) { start=SDL_GetTicks(); SDL_Event event; while(SDL_PollEvent(&event)) {[/color] [color=#0000cd] switch(event.type) { case SDL_QUIT: running=false; break; case SDL_KEYDOWN: switch(event.key.keysym.sym) {[/color] [color=#0000cd] case SDLK_1: //number key 1 can be pressed Mix_PlayChannel(-1, effect1, 0);// there are a total of 8 channels (channel, effect to play, how to repeat) break; case SDLK_2: //number key 1 can be pressed running = false; break; } } }[/color] [color=#0000cd]};[/color] [color=#0000cd]Mix_FreeChunk(effect1); Mix_FreeMusic(music); }[/color] [color=#0000cd]int main(int argc,char** argv) {[/color] [color=#0000cd]SDL_Sound();[/color] [color=#0000cd]//Closing Audio Mix_CloseAudio(); SDL_Quit(); return 0; }[/color]
  6. OpenGL Setting up OpenGL with SDL

    I am having a similar issue too. I am wondering how to get opengl to do all my rendering and use sdl for sound, but for some reason sdl wants to take over. Have you figured out how to do that?
  7. OpenGL Texture fail OPENGL/SDL

    Did you get the answer to your question?
  8. Ok, thanks guys. I understand mathematics well so I get the inverse thing, but I think i am going to try the push and pop matrix thing. I am new to opengl and I want to get a feel for it, so I think I want to use as many commands as possible. Quick question, Should I push the matrix then apply the glTranslate() then pop it after I have called my display list item? Also does pushing and popping the matrix reset scaling?
  9. Hey guys, I am wondering is there any possible way for me to reset the translate function so that it does affect the geometry that I am creating below it. I am using multiple display list so when I use gltranslate it moves everything by that translation, when I actually only want one thing to be translate then end the translate. Is there any way to do it? For example I have: (This is not the actually code, but similar layout. I know the syntax isn't correct in the example.) glTranslatef(x, y, z); displaylist(item1); // I would like to end translate here. //I would like to end the translate before I create the other object glTranslatef(u,v,w); //New translation that I don't want effected by the previous translate displaylist(item2); //I would like to end this new translate and not effect the other display list declared below it Is this possible? Or do I have to subtract the pervious translation from the new translation to make it go back to the original position
  10. OpenGL Putting Models on Terrain Surface

    So basically this is what I am getting from you guys. Its a good idea to store my terrain data. I will store my terrain data as x, y, z coordinates, where y is my height. Then say if I have a model. My model data is read in as x, y, z , but I only check one point on my model which is the bottom most point of the model as the bottom surface. So I can have a check that checks my x and z coordinates, if those coordinates are the same as the house or model have it translate to the surface of the terrain, i.e. gltranslatef(0.0, distance between model and terrain, 0.0); But the question is what is ray, and how can I make use of it to check to see where the terrain and model x and z coordinates intersect? I am unfimilar with rays, what are they exactly? How would I go about writing the conditional statement to tell the program that the model needs to be translated?
  11. Hi guys. I am new to OpenGL. I am trying to figure out a way to make my models be on my terrain. I am kind of confused on how to approach the situation. My terrain is actually an .obj file, so it is easy to apply textures to it. I am wondering should I store every point in the terrain, and try to find the relevant coordinates that are in the same area as my object, then translate it? Or is there an easier way to calculate the top of my terrain, and make some type of collision detection so that the no geometry can go below the terrain? Here is a picture of the terrain's geometry and its UV map: [attachment=5655:Terrain Test Model.jpg] Here is the Terrain Textured: [attachment=5656:Solid Pattern Terrain.jpg] Here is the Terrain Rendered in OpenGL: [attachment=5657:TerrainTestSuccessful.jpg] Here is a house on the terrain, but it is not automatically calculated by the program: [attachment=5658:Translate House on Terrain.jpg] [attachment=5659:Translate House on Terrain2.jpg] My goal is develop something to automatically place the models directly on the surface of the terrain. How would I go about doing that anyone?
  12. Terrain multitexturing problem

    I am new to this as well, but when texturing my terrain I develop the terrain in an modeling program like blender. From there I usually change my nurbs surface into a mesh after that I export my mesh into a UV map. Then I export my UV maps to a painting program such as gimp or photoshop. Then if you export your file as a .obj file or something similar. You will get texture coordinates for your uv maps, vertex coordinates, and vertex normals. From there all you have to do is read the .obj file and it can load up your textures onto your model for you. I don't know if this is the best approach, but its the approach that I am using to texture my terrain.
  13. [quote name='TheUnbeliever' timestamp='1317232970' post='4866875'] I don't know of any off the top of my head, sorry. That's [i]not[/i] to say that they don't exist, though. [/quote] Thanks for the help. I think the obj format is a good one since I can easily map the textures from a UV map of the terrain.
  14. [quote name='TheUnbeliever' timestamp='1317153439' post='4866551'] [quote name='dreamslayerx' timestamp='1317148895' post='4866523']Is this a link to a direct download for the converter, or do I have to download GRIDASCII to be able to convert the data? If so where can GRIDASCII be found, I googled it but didn't get a download link, so I'm assuming its within another program.[/quote] It's a feature of ArcView, a component of ArcGIS. You have a few options (in rough order of practicality) that I can see: [list][*]see if the 'developer tools' listed on the [url="http://www.esri.com/products/index.html"][u]Esri[/u][/url] website contain anything useful[*]search for an alternative parser, knowing the name of the format; the 'GDAL driver' links at the bottom of [url="http://en.wikipedia.org/wiki/Esri_grid"][u]the Wikipedia article[/u][/url] look helpful[*]buttonhole a geo-oriented friend at an academic institution to convert it for you[*]write your own parser using the information on that webpage[*]license ArcGIS at significant cost (thousands of dollars)[/list] Alternatively, [url="http://ned.usgs.gov/Ned/faq.asp#FORMATS"][u]the USGS NED FAQ[/u][/url] suggests that it may be available in other formats from other sources. (Maybe try alternative - lower - resolutions if they'll suffice?) Sorry I can't help more. I've only used this format via ArcGIS, and USGS seems to have changed their format at least twice since I last used them. [/quote] I think that I am going to go the route of create .obj terrains from blender, but is there anyway that dem data can be converted into .obj format with a some form of downloadable converter? Do you know of any?
  15. [quote name='TheUnbeliever' timestamp='1317137776' post='4866471'] I think this is what you're looking for: [url="http://home.gdal.org/projects/aigrid/aigrid_format.html"]http://home.gdal.org...rid_format.html[/url] [/quote] Is this a link to a direct download for the converter, or do I have to download GRIDASCII to be able to convert the data? If so where can GRIDASCII be found, I googled it but didn't get a download link, so I'm assuming its within another program.
  • Advertisement