Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to
LinuxQuestions.org , a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free.
Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please
contact us . If you need to reset your password,
click here .
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a
virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month.
Click here for more info.
05-13-2013, 02:17 PM
#1
LQ Newbie
Registered: May 2013
Posts: 17
Rep:
what include files and libraries do i need to run gtkglext in codeblocks
im trying to include libraries files into code blocks to use gtkglext but i dont know what to include can someone help me
also are their any tuts for gtkglext to get me started
thanks in advance
05-13-2013, 02:18 PM
#2
Senior Member
Registered: May 2006
Posts: 3,091
You should really try to do at least a little research on your own. Googling 'gtkglext example' gives plenty of good results.
Adam
05-13-2013, 02:26 PM
#3
LQ Newbie
Registered: May 2013
Posts: 17
Original Poster
Rep:
i tryed google
i have googled up to 75 pages no good results i even went to git hub but in code blocks its says /home/terrorofdeath/Downloads/adefasdf/main.c|13|fatal error:
gtk/gtkgl.h: No such file or directory
i dont know what to do
05-13-2013, 02:34 PM
#4
LQ Newbie
Registered: May 2013
Posts: 17
Original Poster
Rep:
i tried google
i have googled up to 75 pages no good results i even went to git hub but in code blocks its says /home/terrorofdeath/Downloads/adefasdf/main.c|13|fatal error:
gtk/gtkgl.h: No such file or directory
i dont know what to do
05-13-2013, 02:37 PM
#5
Senior Member
Registered: May 2006
Posts: 3,091
First, you only need to reply once.
Second, does /usr/include/gtkglext-1.0/gtk/gtkgl.h exist? If so, then you aren't specifying the proper include path when using the compiler. You haven't actually told us what command you are running, so we can only guess what you're doing wrong. If that file doesn't exist, then you didn't install the development package for libgtkglext.
Adam
05-13-2013, 02:44 PM
#6
LQ Newbie
Registered: May 2013
Posts: 17
Original Poster
Rep:
i used the command sudo apt-get install libgtkglext1 to install gtkglext and i included the right directory /usr/include/gtkglext-1.0/gtk inside code blocks im not sure why its not compiling properly
05-13-2013, 02:46 PM
#7
Senior Member
Registered: May 2006
Posts: 3,091
You didn't answer my question:
Quote:
Second, does /usr/include/gtkglext-1.0/gtk/gtkgl.h exist?
If you only insalled libgtkglext1 then you didn't actually install the development package. As I said on the previous thread, install both libgtkglext1 and libgtkglext1-dev.
05-13-2013, 02:49 PM
#8
LQ Newbie
Registered: May 2013
Posts: 17
Original Poster
Rep:
i installed both packages and /usr/include/gtkglext-1.0/gtk/gktgl.h exits maybe i need to link a library to the project or something but i dont know what to link maybe
Last edited by terrorofdeath; 05-13-2013 at 02:50 PM .
05-13-2013, 02:51 PM
#9
Senior Member
Registered: May 2006
Posts: 3,091
So then you aren't passing the necessary include path to the compiler, but you still haven't shown us what compiler command is getting run.
If you want help, you need to start asking intelligent questions that include all the necessary information.
In other words: show us the code, show us the command you are running and show us (if applicable) the Makefile.
Adam
05-13-2013, 02:54 PM
#10
LQ Newbie
Registered: May 2013
Posts: 17
Original Poster
Rep:
im using code blocks its says an option for linker options but im new to linux i dont know to add a makefile in here maybe you kno a link library i could try other than that i dont know what do with a makefile
05-13-2013, 02:59 PM
#11
Member
Registered: Apr 2007
Location: West Virginia
Distribution: Pop!_OS
Posts: 945
What are you trying to do? Are you trying to write C or C++ code in codeblocks using the libraries you just downloaded? If yes, show the code. That is what Adamk75 has been asking for.
Have you programmed before?
Last edited by jkirchner; 05-13-2013 at 03:01 PM .
05-13-2013, 03:02 PM
#12
LQ Newbie
Registered: May 2013
Posts: 17
Original Poster
Rep:
heres the code
mybad i didnt understand the ? but heres the code
Code:
/*
* An example of using GtkGLExt in C
*
* Written by Davyd Madeley <davyd@madeley.id.au> and made available under a
* BSD license.
*
* This is purely an example, it may eat your cat and you can keep both pieces.
*
* Compile with:
* gcc -o gtkglext-example `pkg-config --cflags --libs gtk+-2.0 gtkglext-1.0 gtkglext-x11-1.0` gtkglext-example.c
*/
#include <gtk/gtk.h>
#include <gtk/gtkgl.h>
#include <GL/gl.h>
#include <math.h>
float boxv[][3] = {
{ -0.5, -0.5, -0.5 },
{ 0.5, -0.5, -0.5 },
{ 0.5, 0.5, -0.5 },
{ -0.5, 0.5, -0.5 },
{ -0.5, -0.5, 0.5 },
{ 0.5, -0.5, 0.5 },
{ 0.5, 0.5, 0.5 },
{ -0.5, 0.5, 0.5 }
};
#define ALPHA 0.5
static float ang = 30.;
static gboolean
expose (GtkWidget *da, GdkEventExpose *event, gpointer user_data)
{
GdkGLContext *glcontext = gtk_widget_get_gl_context (da);
GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable (da);
// g_print (" :: expose\n");
if (!gdk_gl_drawable_gl_begin (gldrawable, glcontext))
{
g_assert_not_reached ();
}
/* draw in here */
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef (ang, 1, 0, 1);
// glRotatef (ang, 0, 1, 0);
// glRotatef (ang, 0, 0, 1);
glShadeModel(GL_FLAT);
#if 0
glBegin (GL_QUADS);
glColor4f(0.0, 0.0, 1.0, ALPHA);
glVertex3fv(boxv[0]);
glVertex3fv(boxv[1]);
glVertex3fv(boxv[2]);
glVertex3fv(boxv[3]);
glColor4f(1.0, 1.0, 0.0, ALPHA);
glVertex3fv(boxv[0]);
glVertex3fv(boxv[4]);
glVertex3fv(boxv[5]);
glVertex3fv(boxv[1]);
glColor4f(0.0, 1.0, 1.0, ALPHA);
glVertex3fv(boxv[2]);
glVertex3fv(boxv[6]);
glVertex3fv(boxv[7]);
glVertex3fv(boxv[3]);
glColor4f(1.0, 0.0, 0.0, ALPHA);
glVertex3fv(boxv[4]);
glVertex3fv(boxv[5]);
glVertex3fv(boxv[6]);
glVertex3fv(boxv[7]);
glColor4f(1.0, 0.0, 1.0, ALPHA);
glVertex3fv(boxv[0]);
glVertex3fv(boxv[3]);
glVertex3fv(boxv[7]);
glVertex3fv(boxv[4]);
glColor4f(0.0, 1.0, 0.0, ALPHA);
glVertex3fv(boxv[1]);
glVertex3fv(boxv[5]);
glVertex3fv(boxv[6]);
glVertex3fv(boxv[2]);
glEnd ();
#endif
glBegin (GL_LINES);
glColor3f (1., 0., 0.);
glVertex3f (0., 0., 0.);
glVertex3f (1., 0., 0.);
glEnd ();
glBegin (GL_LINES);
glColor3f (0., 1., 0.);
glVertex3f (0., 0., 0.);
glVertex3f (0., 1., 0.);
glEnd ();
glBegin (GL_LINES);
glColor3f (0., 0., 1.);
glVertex3f (0., 0., 0.);
glVertex3f (0., 0., 1.);
glEnd ();
glBegin(GL_LINES);
glColor3f (1., 1., 1.);
glVertex3fv(boxv[0]);
glVertex3fv(boxv[1]);
glVertex3fv(boxv[1]);
glVertex3fv(boxv[2]);
glVertex3fv(boxv[2]);
glVertex3fv(boxv[3]);
glVertex3fv(boxv[3]);
glVertex3fv(boxv[0]);
glVertex3fv(boxv[4]);
glVertex3fv(boxv[5]);
glVertex3fv(boxv[5]);
glVertex3fv(boxv[6]);
glVertex3fv(boxv[6]);
glVertex3fv(boxv[7]);
glVertex3fv(boxv[7]);
glVertex3fv(boxv[4]);
glVertex3fv(boxv[0]);
glVertex3fv(boxv[4]);
glVertex3fv(boxv[1]);
glVertex3fv(boxv[5]);
glVertex3fv(boxv[2]);
glVertex3fv(boxv[6]);
glVertex3fv(boxv[3]);
glVertex3fv(boxv[7]);
glEnd();
glPopMatrix ();
if (gdk_gl_drawable_is_double_buffered (gldrawable))
gdk_gl_drawable_swap_buffers (gldrawable);
else
glFlush ();
gdk_gl_drawable_gl_end (gldrawable);
return TRUE;
}
static gboolean
configure (GtkWidget *da, GdkEventConfigure *event, gpointer user_data)
{
GdkGLContext *glcontext = gtk_widget_get_gl_context (da);
GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable (da);
if (!gdk_gl_drawable_gl_begin (gldrawable, glcontext))
{
g_assert_not_reached ();
}
glLoadIdentity();
glViewport (0, 0, da->allocation.width, da->allocation.height);
glOrtho (-10,10,-10,10,-20050,10000);
glEnable (GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glScalef (10., 10., 10.);
gdk_gl_drawable_gl_end (gldrawable);
return TRUE;
}
static gboolean
rotate (gpointer user_data)
{
GtkWidget *da = GTK_WIDGET (user_data);
ang++;
gdk_window_invalidate_rect (da->window, &da->allocation, FALSE);
gdk_window_process_updates (da->window, FALSE);
return TRUE;
}
int
main (int argc, char **argv)
{
GtkWidget *window;
GtkWidget *da;
GdkGLConfig *glconfig;
gtk_init (&argc, &argv);
gtk_gl_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size (GTK_WINDOW (window), 800, 600);
da = gtk_drawing_area_new ();
gtk_container_add (GTK_CONTAINER (window), da);
g_signal_connect_swapped (window, "destroy",
G_CALLBACK (gtk_main_quit), NULL);
gtk_widget_set_events (da, GDK_EXPOSURE_MASK);
gtk_widget_show (window);
/* prepare GL */
glconfig = gdk_gl_config_new_by_mode (
GDK_GL_MODE_RGB |
GDK_GL_MODE_DEPTH |
GDK_GL_MODE_DOUBLE);
if (!glconfig)
{
g_assert_not_reached ();
}
if (!gtk_widget_set_gl_capability (da, glconfig, NULL, TRUE,
GDK_GL_RGBA_TYPE))
{
g_assert_not_reached ();
}
g_signal_connect (da, "configure-event",
G_CALLBACK (configure), NULL);
g_signal_connect (da, "expose-event",
G_CALLBACK (expose), NULL);
gtk_widget_show_all (window);
g_timeout_add (1000 / 60, rotate, da);
gtk_main ();
}
05-13-2013, 03:08 PM
#13
LQ Newbie
Registered: May 2013
Posts: 17
Original Poster
Rep:
mybad i didn't understand the ? heres the code
Code:
#include <gtk/gtk.h>
#include <gtk/gtkgl.h>
#include <GL/gl.h>
#include <math.h>
float boxv[][3] = {
{ -0.5, -0.5, -0.5 },
{ 0.5, -0.5, -0.5 },
{ 0.5, 0.5, -0.5 },
{ -0.5, 0.5, -0.5 },
{ -0.5, -0.5, 0.5 },
{ 0.5, -0.5, 0.5 },
{ 0.5, 0.5, 0.5 },
{ -0.5, 0.5, 0.5 }
};
#define ALPHA 0.5
static float ang = 30.;
static gboolean
expose (GtkWidget *da, GdkEventExpose *event, gpointer user_data)
{
GdkGLContext *glcontext = gtk_widget_get_gl_context (da);
GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable (da);
// g_print (" :: expose\n");
if (!gdk_gl_drawable_gl_begin (gldrawable, glcontext))
{
g_assert_not_reached ();
}
/* draw in here */
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef (ang, 1, 0, 1);
// glRotatef (ang, 0, 1, 0);
// glRotatef (ang, 0, 0, 1);
glShadeModel(GL_FLAT);
#if 0
glBegin (GL_QUADS);
glColor4f(0.0, 0.0, 1.0, ALPHA);
glVertex3fv(boxv[0]);
glVertex3fv(boxv[1]);
glVertex3fv(boxv[2]);
glVertex3fv(boxv[3]);
glColor4f(1.0, 1.0, 0.0, ALPHA);
glVertex3fv(boxv[0]);
glVertex3fv(boxv[4]);
glVertex3fv(boxv[5]);
glVertex3fv(boxv[1]);
glColor4f(0.0, 1.0, 1.0, ALPHA);
glVertex3fv(boxv[2]);
glVertex3fv(boxv[6]);
glVertex3fv(boxv[7]);
glVertex3fv(boxv[3]);
glColor4f(1.0, 0.0, 0.0, ALPHA);
glVertex3fv(boxv[4]);
glVertex3fv(boxv[5]);
glVertex3fv(boxv[6]);
glVertex3fv(boxv[7]);
glColor4f(1.0, 0.0, 1.0, ALPHA);
glVertex3fv(boxv[0]);
glVertex3fv(boxv[3]);
glVertex3fv(boxv[7]);
glVertex3fv(boxv[4]);
glColor4f(0.0, 1.0, 0.0, ALPHA);
glVertex3fv(boxv[1]);
glVertex3fv(boxv[5]);
glVertex3fv(boxv[6]);
glVertex3fv(boxv[2]);
glEnd ();
#endif
glBegin (GL_LINES);
glColor3f (1., 0., 0.);
glVertex3f (0., 0., 0.);
glVertex3f (1., 0., 0.);
glEnd ();
glBegin (GL_LINES);
glColor3f (0., 1., 0.);
glVertex3f (0., 0., 0.);
glVertex3f (0., 1., 0.);
glEnd ();
glBegin (GL_LINES);
glColor3f (0., 0., 1.);
glVertex3f (0., 0., 0.);
glVertex3f (0., 0., 1.);
glEnd ();
glBegin(GL_LINES);
glColor3f (1., 1., 1.);
glVertex3fv(boxv[0]);
glVertex3fv(boxv[1]);
glVertex3fv(boxv[1]);
glVertex3fv(boxv[2]);
glVertex3fv(boxv[2]);
glVertex3fv(boxv[3]);
glVertex3fv(boxv[3]);
glVertex3fv(boxv[0]);
glVertex3fv(boxv[4]);
glVertex3fv(boxv[5]);
glVertex3fv(boxv[5]);
glVertex3fv(boxv[6]);
glVertex3fv(boxv[6]);
glVertex3fv(boxv[7]);
glVertex3fv(boxv[7]);
glVertex3fv(boxv[4]);
glVertex3fv(boxv[0]);
glVertex3fv(boxv[4]);
glVertex3fv(boxv[1]);
glVertex3fv(boxv[5]);
glVertex3fv(boxv[2]);
glVertex3fv(boxv[6]);
glVertex3fv(boxv[3]);
glVertex3fv(boxv[7]);
glEnd();
glPopMatrix ();
if (gdk_gl_drawable_is_double_buffered (gldrawable))
gdk_gl_drawable_swap_buffers (gldrawable);
else
glFlush ();
gdk_gl_drawable_gl_end (gldrawable);
return TRUE;
}
static gboolean
configure (GtkWidget *da, GdkEventConfigure *event, gpointer user_data)
{
GdkGLContext *glcontext = gtk_widget_get_gl_context (da);
GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable (da);
if (!gdk_gl_drawable_gl_begin (gldrawable, glcontext))
{
g_assert_not_reached ();
}
glLoadIdentity();
glViewport (0, 0, da->allocation.width, da->allocation.height);
glOrtho (-10,10,-10,10,-20050,10000);
glEnable (GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glScalef (10., 10., 10.);
gdk_gl_drawable_gl_end (gldrawable);
return TRUE;
}
static gboolean
rotate (gpointer user_data)
{
GtkWidget *da = GTK_WIDGET (user_data);
ang++;
gdk_window_invalidate_rect (da->window, &da->allocation, FALSE);
gdk_window_process_updates (da->window, FALSE);
return TRUE;
}
int
main (int argc, char **argv)
{
GtkWidget *window;
GtkWidget *da;
GdkGLConfig *glconfig;
gtk_init (&argc, &argv);
gtk_gl_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size (GTK_WINDOW (window), 800, 600);
da = gtk_drawing_area_new ();
gtk_container_add (GTK_CONTAINER (window), da);
g_signal_connect_swapped (window, "destroy",
G_CALLBACK (gtk_main_quit), NULL);
gtk_widget_set_events (da, GDK_EXPOSURE_MASK);
gtk_widget_show (window);
/* prepare GL */
glconfig = gdk_gl_config_new_by_mode (
GDK_GL_MODE_RGB |
GDK_GL_MODE_DEPTH |
GDK_GL_MODE_DOUBLE);
if (!glconfig)
{
g_assert_not_reached ();
}
if (!gtk_widget_set_gl_capability (da, glconfig, NULL, TRUE,
GDK_GL_RGBA_TYPE))
{
g_assert_not_reached ();
}
g_signal_connect (da, "configure-event",
G_CALLBACK (configure), NULL);
g_signal_connect (da, "expose-event",
G_CALLBACK (expose), NULL);
gtk_widget_show_all (window);
g_timeout_add (1000 / 60, rotate, da);
gtk_main ();
}
All times are GMT -5. The time now is 10:15 AM .
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know .
Latest Threads
LQ News