I just developed my first app on android, so I'd like to share my experience.
1. Download and install the latest JDK: http://www.oracle.com/technetwork/java/javase/downloads/index.html
2. Download android SDK: http://developer.android.com/sdk/index.html , and install the packages you need.
3. Download the Eclipse: http://www.eclipse.org/downloads/ . Here you doesn't need to install it. Just open the folder and you can use it.
4. Install android plug-in to Eclipse. Open Eclipse, 'Help'->'Install New Software', input the following address: https://dl-ssl.google.com/android/eclipse/
Press 'Next' button and select all, then finish.
5. Open android AVD Manager. Create a new Android Virtual Device.
6. Turn to Eclipse, new an android project and you can run it as android application. After finishing your program, you can export your project to a APK file, then copy the file into your android device, install it, then you can play with your own app in your android.
That's all. Thanks for viewing my post.
I'm gonna write more about android app development.
Friday, 14 September 2012
Saturday, 18 August 2012
OpenGL beginning guide(glui)
1. Download the latest version of glui sourse code. (mine was glui-2.36)
2. Extract the zip file, and open the src/msvc/glui.sln file in vc++
3. Select the _glui library and build the library.
4. After building the library, the lib file (glui32d.lib), glui32d.lib – ‘d’ for debug, will be stored in the msvc\lib directory.
5. Put the glui32d.lib file into
6. Put the glui.h file into
7. Create new project and try to compile. That's all.
Note : For VS 2010 users, the error below may be generated when compiling the library.
Try this,
2. Extract the zip file, and open the src/msvc/glui.sln file in vc++
3. Select the _glui library and build the library.
4. After building the library, the lib file (glui32d.lib), glui32d.lib – ‘d’ for debug, will be stored in the msvc\lib directory.
5. Put the glui32d.lib file into
C:\Program Files\Microsoft Visual Studio 10.0\VC\lib directory and rename to glui32.lib6. Put the glui.h file into
C:\Program Files\Microsoft Visual Studio 10.0\VC\include directory.7. Create new project and try to compile. That's all.
Note : For VS 2010 users, the error below may be generated when compiling the library.
1 | error C2252: an explicit instantiation of a template can only occur at namespace scope |
Try this,
- Cut the corresponding block code and paste outside the class GLUIAPI GLUI_CommandLine definition
1#ifdef _MSC_VER2// Explicit template instantiation needed for dll3templateclassGLUIAPI std::allocator<GLUI_String>;4templateclassGLUIAPI std::vector<GLUI_String,5std::allocator<GLUI_String> >;6#endif - Put #include <iterator> after #include <cstdlib>
1#include <cstdlib>2#include <iterator>
- Build it as usual
Wednesday, 8 August 2012
A Sample using GLUT
This is a sample of a moving cube:
#include <iostream>
#include <GL/glut.h>
#include <cstdlib>
using namespace std;
static GLfloat spin=0.0;
void init(void){
glClearColor(0.0,0.0,0.0,0.0);
glShadeModel(GL_FLAT);
}
void display(void){
glClear(GL_COLOR_BUFFER_BIT);
glPushMatrix();
glRotatef(spin,0.0,0.0,1.0);
glColor3f(1.0,1.0,1.0);
glRectf(-25.0,-25.0,25.0,25.0);
glPopMatrix();
glutSwapBuffers();
}
void spinDisplay(void){
spin=spin+1.5;
if(spin>360.0)
spin=spin-360.0;
glutPostRedisplay();
}
void reshape(int w, int h){
glViewport(0,0,(GLsizei)w,(GLsizei)h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-50.0,50.0,-50.0,50.0,-1.0,1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
void mouse(int button, int state, int x, int y){
switch(button){
case GLUT_LEFT_BUTTON:
if (state==GLUT_DOWN)
glutIdleFunc(spinDisplay);
break;
case GLUT_RIGHT_BUTTON:
if (state==GLUT_DOWN)
glutIdleFunc(NULL);
break;
default:
break;
}
}
int main(int argc, char** argv){
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB);
glutInitWindowSize(250,250);
glutInitWindowPosition(100,100);
glutCreateWindow(argv[0]);
init();
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutMouseFunc(mouse);
glutMainLoop();
return 0;
}
#include <iostream>
#include <GL/glut.h>
#include <cstdlib>
using namespace std;
static GLfloat spin=0.0;
void init(void){
glClearColor(0.0,0.0,0.0,0.0);
glShadeModel(GL_FLAT);
}
void display(void){
glClear(GL_COLOR_BUFFER_BIT);
glPushMatrix();
glRotatef(spin,0.0,0.0,1.0);
glColor3f(1.0,1.0,1.0);
glRectf(-25.0,-25.0,25.0,25.0);
glPopMatrix();
glutSwapBuffers();
}
void spinDisplay(void){
spin=spin+1.5;
if(spin>360.0)
spin=spin-360.0;
glutPostRedisplay();
}
void reshape(int w, int h){
glViewport(0,0,(GLsizei)w,(GLsizei)h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-50.0,50.0,-50.0,50.0,-1.0,1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
void mouse(int button, int state, int x, int y){
switch(button){
case GLUT_LEFT_BUTTON:
if (state==GLUT_DOWN)
glutIdleFunc(spinDisplay);
break;
case GLUT_RIGHT_BUTTON:
if (state==GLUT_DOWN)
glutIdleFunc(NULL);
break;
default:
break;
}
}
int main(int argc, char** argv){
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB);
glutInitWindowSize(250,250);
glutInitWindowPosition(100,100);
glutCreateWindow(argv[0]);
init();
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutMouseFunc(mouse);
glutMainLoop();
return 0;
}
Thursday, 2 August 2012
OpenGL Beginning Guide(glut)
1. Download C++ Express at
http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-cpp-express
2. Install C++ Express.
3. Download OpenGL files at http://www.opengl.org/resources/libraries/glut/
4. Copy files as follows:
glut.h/glu.h/gl.h : C:\Program Files\Microsoft Visual Studio [version]\VC[version]\include\GL
glut32.lib : C:\Program Files\Microsoft Visual Studio [version]\VC[version]\lib
glut32.dll : C:\Windows\System32; C:\Program Files\Microsoft Visual Studio [version]\VC[version]\bin
5. Open C++ Express and create your own project.
references:
http://cacs.usc.edu/education/cs596/OGL_Setup.pdf
http://www.mbsoftworks.sk/index.php?page=tutorials&series=1
http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-cpp-express
2. Install C++ Express.
3. Download OpenGL files at http://www.opengl.org/resources/libraries/glut/
4. Copy files as follows:
glut.h/glu.h/gl.h : C:\Program Files\Microsoft Visual Studio [version]\VC[version]\include\GL
glut32.lib : C:\Program Files\Microsoft Visual Studio [version]\VC[version]\lib
glut32.dll : C:\Windows\System32; C:\Program Files\Microsoft Visual Studio [version]\VC[version]\bin
5. Open C++ Express and create your own project.
references:
http://cacs.usc.edu/education/cs596/OGL_Setup.pdf
http://www.mbsoftworks.sk/index.php?page=tutorials&series=1
Subscribe to:
Posts (Atom)