PDA

View Full Version : Installing an editor...



strongnas
05-06-2015, 02:36 AM
Hi...

I've been using OpenGL on windows and used microsoft visual studio but windows caused some problems to my pc so i've installed linux mint....here i could not find something for open gl can anyone help me please?


thank you in advance...

hidefromkgb
05-06-2015, 02:53 AM
Try Code::Blocks. It has OpenGL project templates out of the box.

Agent D
05-06-2015, 08:10 AM
You don't need a special software to write C code or programs that uses OpenGL(R). Any text editor will do.

You can take whatever text editor or IDE you like.

Visual Studio(R) is an IDE. Code::Blocks is also an IDE.

Gedit (GUI, typically on Gnome based systems), Kate (GUI, typically on KDE based systems),
Emacs (commandline), Vim (commandline) and the like are text editors.

The C code itself is compiled by the C compiler, not the fancy text editing program.

strongnas
05-07-2015, 02:30 PM
thank you #hidefromkgb....Agend D im using OpenGL in c++...visual studio seemes will never be installed on linux ...:)

hidefromkgb
05-08-2015, 04:34 AM
JFYI, Agent D has a valid point. As long as you have a proper toolchain for the language and framework set you are using, the editor does not matter. Everything that C::B can do may also be achieved via makefiles or just by typing a bunch of shell commands into a terminal.

strongnas
05-09-2015, 05:18 AM
i tried using code::blocks
this code is showing me some problems should i include something else?



#include<GL/glew.h>
#include<GL/glut.h>
void Display()
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_QUADS);
glColor3f(0.2,0.0,0.0);
glVertex2f(10.0,110.0);
glVertex2f(10.0,115.0);
glVertex2f(20.0,115.0);
glVertex2f(20.0,110.0);

glColor3f(1.0,1.0,0.0);
glVertex2f(10.0,0.0);
glVertex2f(10.0,100.0);
glVertex2f(110.0,100.0);
glVertex2f(110.0,0.0);

glColor3f(0.8,0.8,0.8);
glVertex2f(20.0,60.0);
glVertex2f(20.0,80.0);
glVertex2f(40.0,80.0);
glVertex2f(40.0,60.0);

glVertex2f(70.0,60.0);
glVertex2f(70.0,60.0);
glVertex2f(90.0,80.0);
glVertex2f(90.0,80.0);

glVertex2f(70.0,60.0);
glVertex2f(70.0,80.0);
glVertex2f(90.0,80.0);
glVertex2f(90.0,60.0);

glColor3f(0.0,1.0,1.0);
glVertex2f(45.0,0.0);
glVertex2f(45.0,50.0);
glVertex2f(65.0,50.0);
glVertex2f(65.0,0.0);
glEnd();
glBegin(GL_TRIANGLES);
glColor3f(0.9,0.0,0.0);
glVertex2f(0.0,100.0);
glVertex2f(55.0,120.0);
glVertex2f(110.0,100.0);
glEnd();
glFlush();
}
void init()
{
glClearColor(0.0,0.0,0.0,1.0);
glViewport(0,0,110,120);
glOrtho2D(0.0,110.0,0.0,120.0);
}
int main(int a,char* v[])
{
glutInitDisplayMode(GLUT_SINGLE);
glutInitWindowSize(110,120);
glutCreateWindow("Shtepi");
init();
glutDisplayFunc(Display);
glutMainLoop();
}

hidefromkgb
05-09-2015, 05:29 AM
Yep.
Firstly, you should add glutInit(&a, v); right before glutInitDisplayMode. Secondly, there`s no such thing as glOrtho2D. What you need is called gluOrtho2D.

[UPD:] Nice drawing, BTW ^_^

strongnas
05-09-2015, 05:36 AM
thank you man....