Ben Russell
X-Plugins-
Posts
3,822 -
Joined
-
Last visited
-
Days Won
109
Content Type
Profiles
Forums
Latest X-Plane & Community News
Events
Downloads
Store
Everything posted by Ben Russell
-
Philip chose to use an exotic flavour of C/C++ for reasons known best to him. (Gizmo remains 10.6 compatible as I am still using 10.6.8)
-
If you want to truly experience the "Joy" of limits, please go and develop for a console or iOS device. It sucks.
-
Artist time investment is worth more than computer hardware. Computer hardware gets cheaper every year. "Life" becomes more priceless every year.
-
No thanks. Next.
-
Earlier this year I checked through all the libs I have used to create gizmo and am confident that all of them will work when compiled as 64bit. Now that laminar have begun releasing 64bit builds I finally have a real reason to install v10 so that I can build and test against it.
-
Gizmo has an API that lets you yield the CPU. function main() gizmo.sleep(10) end ...will sleep for 10ms every frame. This can be used to tune X-Plane easily on demand and is used internally a lot during development to allow better use of the entire content tool chain.
-
Create a new plugin project. Import the code above. Use the code above to load and compile shader scripts of your choice. Create appropriate drawing callbacks that fire at the desired phase of X-Planes rendering system. Call the code above that enables shader drawing. Draw custom mesh loaded by your own code. (Eg: You'll need to write/find an OBJ8/FBX reader too.) Call the code above that disables shader drawing. Or, you can look into Gizmo, which has a shader API, and makes all of the above far far easier.
-
#ifndef __XGL_SHADER__ #define __XGL_SHADER__ /* #if IBM #include "GL/glu.h" #include "GL/glext.h" #else #include <OpenGL/glu.h> #include <OpenGL/glext.h> #endif */ //usefull STL classes //#include "X_STL.h" #define printOpenGLError() this->printOglError(__FILE__, __LINE__) class XGLShader{ public: int compileShaders( const char *shdrVertex, const char *shdrFragment ); void enable(); void disable(); void setUniFloat( const char *name, float fV ); GLhandleARB sp; // <-- shaders handle for openGL. //private: int validShader; //will only set to 1 if the compile succeeds. controls enable disable logic too. void printOglError( char *file, int line ); void printInfoLog(GLhandleARB obj); GLint getUniLoc(GLhandleARB program, const GLcharARB *name); protected: }; #endif void XGLShader::printOglError( char *file, int line ){ GLenum glErr; int retCode = 0; char *err; // returns 1 if an OpenGL error occurred, 0 otherwise. glErr = glGetError(); while (glErr != GL_NO_ERROR) { err = (char*)gluErrorString(glErr); fprintf(stderr,"file: %s \n line: %d \n glError: %s\n",file,line,err); retCode = 1; glErr = glGetError(); } //return retCode }; void XGLShader::printInfoLog(GLhandleARB obj) { int infologLength = 0; int charsWritten = 0; GLcharARB *infoLog; printOpenGLError(); // Check for OpenGL errors glGetObjectParameterivARB(obj, GL_OBJECT_INFO_LOG_LENGTH_ARB, (GLint*)&infologLength); printOpenGLError(); // Check for OpenGL errors if (infologLength > 0) { infoLog = (GLcharARB*)malloc(infologLength); if (infoLog == NULL) { printf("ERROR: Could not allocate InfoLog buffer\n"); exit(1); } glGetInfoLogARB(obj, infologLength, (GLint*)&charsWritten, infoLog); printf("InfoLog:\n%s\n\n", infoLog); free(infoLog); } printOpenGLError(); // Check for OpenGL errors } GLint XGLShader::getUniLoc(GLhandleARB program, const GLcharARB *name) { GLint loc; loc = glGetUniformLocationARB(program, name); if (loc == -1) printf("No such uniform named \"%s\"\n", name); printOpenGLError(); // Check for OpenGL errors return loc; } int XGLShader::compileShaders( const char *shdrVertex, const char *shdrFragment ) { GLhandleARB shdrVS, shdrFS;//, shdrProg; // handles to objects GLint vertCompiled, fragCompiled; // status values GLint linked; // Create a vertex shader object and a fragment shader object shdrVS = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB); shdrFS = glCreateShaderObjectARB(GL_FRAGMENT_SHADER); // Load source code strings into shaders glShaderSourceARB(shdrVS, 1, &shdrVertex, NULL); glShaderSourceARB(shdrFS, 1, &shdrFragment, NULL); // Compile the shdr vertex shader and print out // the compiler log file. glCompileShaderARB(shdrVS); printOpenGLError(); // Check for OpenGL errors glGetObjectParameterivARB(shdrVS, GL_OBJECT_COMPILE_STATUS_ARB, &vertCompiled); this->printInfoLog(shdrVS); // Compile the shdr vertex shader and print out // the compiler log file. glCompileShaderARB(shdrFS); printOpenGLError(); // Check for OpenGL errors glGetObjectParameterivARB(shdrFS, GL_OBJECT_COMPILE_STATUS_ARB, &fragCompiled); this->printInfoLog(shdrFS); if (!vertCompiled || !fragCompiled) return 0; // Create a program object and attach the two compiled shaders this->sp = glCreateProgramObjectARB(); glAttachObjectARB(this->sp, shdrVS); glAttachObjectARB(this->sp, shdrFS); // Link the program object and print out the info log glLinkProgramARB(this->sp); printOpenGLError(); // Check for OpenGL errors glGetObjectParameterivARB(this->sp, GL_OBJECT_LINK_STATUS_ARB, &linked); this->printInfoLog(this->sp); if (!linked) return 0; // Install program object as part of current state //glUseProgramObjectARB(shdrProg); // Set up initial uniform values //glUniform3fARB( getUniLoc(shdrProg, "BrickColor"), 1.0, 0.3, 0.2); //glUniform3fARB( getUniLoc(shdrProg, "MortarColor"), 0.85, 0.86, 0.84); //glUniform2fARB( getUniLoc(shdrProg, "BrickSize"), 0.30, 0.15); //glUniform2fARB( getUniLoc(shdrProg, "BrickPct"), 0.90, 0.85); //glUniform3fARB( getUniLoc(shdrProg, "LightPosition"), 0.0, 0.0, 4.0); this->validShader = 1; return 1; } void XGLShader::setUniFloat( const char *name, float fV ){ glUniform1fARB( getUniLoc(this->sp, name), fV ); //printf("set uni float %s to: %f\n", name, fV); } void XGLShader::enable(){ if( this->validShader ){ //we need this in versions of x-plane prior to about 8.4 or 8.5 that did not have native shader support //glEnable(GL_VERTEX_PROGRAM_ARB); //glEnable(GL_FRAGMENT_PROGRAM_ARB); glUseProgramObjectARB( this->sp ); }else{ printf("XGLShader - tried to enable an invalid shader instance. Ignored.\n"); } } void XGLShader::disable(){ if( this->validShader ){ //we need this in versions of x-plane prior to about 8.4 or 8.5 that did not have native shader support //glDisable(GL_VERTEX_PROGRAM_ARB); //glDisable(GL_FRAGMENT_PROGRAM_ARB); glUseProgramObjectARB( 0 ); } }
-
I have provided a full link to working source code that can be used in an XPL file. I have published Gizmo, allowing use of shaders via Lua script.
-
Give a man a fish and he'll eat for a day. Teach a man to fish...
-
Advanced Scenery Design and Dev Pipeline?
Ben Russell replied to Hawk UK's topic in Scenery Development
I only looked into it quickly but at first glance; - There is no license fee. - Documentation, SDKs and resources are easily available. - Blender uses an FBX script created with information from the SDK. ...maybe Laminar just don't realise how open this door is. -shrugs- I will not be pursuing it with them. I have no need for FBX, but plenty of other items on my personal wish list. -
I have already shared more than you ever will. http://forums.x-plane.org/index.php?showtopic=53783
-
Rubbish. http://www.wired.com/threatlevel/2012/03/zero-days-for-chrome/
-
If I can do it with Google, so can you.
-
Advanced Scenery Design and Dev Pipeline?
Ben Russell replied to Hawk UK's topic in Scenery Development
http://usa.autodesk.com/fbx/ -
Yes, that was me.
-
Got a link to some video of Dan and Ramzzes work?
-
Advanced Scenery Design and Dev Pipeline?
Ben Russell replied to Hawk UK's topic in Scenery Development
Get a job. 30 euros is peanuts. (http://www.steptosky.com/forum/index.php?topic=22.0) -
A/C conversion, but author cannot be reached - what can we do?
Ben Russell replied to ksgy's topic in Help!?!
Copyright in the US lasts approximately 50 years. Content authors of all forms are AUTOMATICALLY protected by Copyright law by simply creating something. No Copyright "registration" is required for protection. If you cannot contact the original author then you CANNOT re-release their work unless the original work specifically grants you those rights by using a Creative Commons or similar licensing agreement. However: What you do in your own time, between friends, in private communications, is entirely your business. -
These issues have been solved. Gizmo 12.9-beta was released today for private developer review.
-
Thanks for decoding the logs Chris, I'm sure a lot of people will find this useful over time... ..and thank's to the OP for posting their log file so we can all learn.
-
My car makes this kind of squeaky grindy noise. Is that dangerous or bad? Seriously, details or don't bother. Some messages are bad, lots can be ignored. Without an extract from your actual log file we're just guessing and you're wasting your time and ours.
-
This is software. Not a religious cult.
-
Yeah, nothing more heartbreaking than a Ferrari driving, cirrus flying millionaire in court over paying license fees.. This is not a new problem for software. Austin's "poor me" attitude is pathetic given the resources and success he -already- has.
-
Thanks for the info.