Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
149 user(s) are online (142 user(s) are browsing Forums)

Members: 1
Guests: 148

MickJT, more...

Support us!

Headlines

 
  Register To Post  

GLUT Samples ..
Quite a regular
Quite a regular


See User information
Hi all,

I've seen that there are GLUT.h functions that use GLcontext context integer.
But none of the samples available on HANS website nor, sample in MiniGL1.5.1 uses them ...

How can I setup context to use functions that need contexts ?

For example, samples that run in windowed mode, does not close the windows and close window need GLContext context.

Any clue ?

Kindest Regards,
Freddix

All we have to decide is what to do with the time that is given to us.
Go to top
Re: GLUT Samples ..
Home away from home
Home away from home


See User information
@freddix

Quote:

freddix wrote:
Hi all,

I've seen that there are GLUT.h functions that use GLcontext context integer.
But none of the samples available on HANS website nor, sample in MiniGL1.5.1 uses them ...


Which particular GLUT.h are you talking about? There are several in different sub-directories. The truth is that you should not be touching the MiniGL context directly. You call the gl*() or glut*() functions, and they use the current active context. This is why you see no examples touching the context directly.

Quote:
How can I setup context to use functions that need contexts ?


I think that you are confusing yourself by looking through the header files. I recommend that you buy/borrow a few books on OpenGL, if you haven't already, and look at their examples. I have a set of recommendations on my website, here.

Quote:

For example, samples that run in windowed mode, does not close the windows and close window need GLContext context.

Any clue ?


All of the samples that come with MiniGL should close their windows on exit, either when you click on the close gadget, or if you push escape.

There is a glutDestroyWindow() function, and it doesn't need a GLcontext. However, GLUT automatically closes the windows on exit. You can find the GLUT API specification here. It's missing a few of the more recent extensions such as glutGameMode(), but it's still a useful document.

I'll reiterate my recommendation to get a hold of some OpenGL books; I initially tried to learn without them, and found it pretty heavy going.

Hans

Join Kea Campus' Amiga Corner and support Amiga content creation
https://keasigmadelta.com/ - see more of my work
Go to top
Re: GLUT Samples ..
Quite a regular
Quite a regular


See User information
@Hans
I don't get confused about GLcontext, I've checked in the .h files and I've seen that GLcontext is a structure to simplify the use of GL windows (I'm right ? not ?) by handling many things in it ...

Quote:
There is a glutDestroyWindow() function, and it doesn't need a GLcontext. However, GLUT automatically closes the windows on exit. You can find the GLUT API specification here. It's missing a few of the more recent extensions such as glutGameMode(), but it's still a useful document


It's exactly this function glutDestroyWindow() that need a GLcontext ... and many others in the glut.h that contain reference to this function that ask for GLcontest argument ...

I cannot buy OpenGL books because they're all in english and I'm not english, I'm french so a full book about openGL should take ages for me to learn ... That's why I must learn with samples directly and help of other persons ...

All we have to decide is what to do with the time that is given to us.
Go to top
Re: GLUT Samples ..
Home away from home
Home away from home


See User information
@freddix

Quote:

freddix wrote:
@Hans
I don't get confused about GLcontext, I've checked in the .h files and I've seen that GLcontext is a structure to simplify the use of GL windows (I'm right ? not ?) by handling many things in it ...


You're wrong. The GLContext is is an internal structure that is used for everything. When using GLUT you should never directly touch any GLContext.

Quote:
Quote:
There is a glutDestroyWindow() function, and it doesn't need a GLcontext. However, GLUT automatically closes the windows on exit. You can find the GLUT API specification here. It's missing a few of the more recent extensions such as glutGameMode(), but it's still a useful document


It's exactly this function glutDestroyWindow() that need a GLcontext ... and many others in the glut.h that contain reference to this function that ask for GLcontest argument ...


No. If you look at the GLUT API documentation, you'll see that glutDestroyWindow() takes a window ID, not a GLcontext. This is the window ID returned by glutCreateWindow().

Stop looking at the header files, and look at the OpenGL documentation and sample code. There is a header file that contains function stubs that handles all the GLcontext stuff for you. This is so that you can program in OpenGL exactly as per the specification.

Quote:
I cannot buy OpenGL books because they're all in english and I'm not english, I'm french so a full book about openGL should take ages for me to learn ... That's why I must learn with samples directly and help of other persons ...


But those samples are in English too. You will be better off learning from English books/documentation, than trying to learn from samples alone. I tried without books initially, but it was incredibly hard that way. BTW, there are one or two OpenGL books in French. Just click through to the French amazon site and do a search for OpenGL.

Hans

Join Kea Campus' Amiga Corner and support Amiga content creation
https://keasigmadelta.com/ - see more of my work
Go to top
Re: GLUT Samples ..
Quite a regular
Quite a regular


See User information
@Hans
Hi Hans,

In fact, I have an old OpenGL 1 book (english book).

I'd made some tests and learning a bit from book on how OpenGL. work.
I think I've understood now the basis of it.

Here is my first test that run well :


OpenGL Sample #1
    
Show a simple box on the screen
*/

#include <GL/glut.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

/*  WHAT WE WANT TO DISPLAY ON SCREEN MUST BE ADDED IN THIS FUNCTION */
void My_glRenderingvoid )
{
  
glClearColor0.00.00.00.0);    /* Set backdrop as black */
  
glClearGL_COLOR_BUFFER_BIT );   /* Clear the backdrop with glClearColor color */
  
glColor3f1.01.01.0 );

  
glBegin(GL_POLYGON) ;
    
glVertex3f0.250.250.0 );
    
glVertex3f0.750.250.0 );
    
glVertex3f0.750.750.0 );
    
glVertex3f0.250.750.0 );
   
glEnd() ;

  
glFlush();
 }

/* SOME INITIALIZATIONS HERE */
void My_glInitvoid )
{
  
glMatrixModeGL_PROJECTION );
  
glLoadIdentity() ;
  
glOrtho0.01.00.01.0, -1.01.0 );
 }




/* MAIN C PROCEDURE STARTUP-SEQUENCE IS HERE */
int main(int argcchar** argv)
{
  
glutInit(&argcargv);    /* Initialize Glut */
  
glutInitDisplayMode(GLUT_SINGLE GLUT_RGB);   /* Define display mode properties such as single buffer, color mode and  */
  
glutInitWindowSize640480 );         /* define the sizes of the window to create */
  
glutInitWindowPosition300300 );
  
glutCreateWindow("AmiDARK Test Window");       /* Create the final rendering window */

  
My_glInit();
  
glutDisplayFuncMy_glRendering );
  
glutMainLoop();

  return 
0;
 }


I'm also beginner in C / C++ coding ...

[EDIT]
Thank you hans for all informations and help :)


Edited by freddix on 2009/2/13 19:00:40
All we have to decide is what to do with the time that is given to us.
Go to top
Re: GLUT Samples ..
Home away from home
Home away from home


See User information
@freddix

You're welcome. Learning OpenGL isn't the easiest way to learn C/C++ programming, but it's probably more fun than starting with console only stuff.

Hans

Join Kea Campus' Amiga Corner and support Amiga content creation
https://keasigmadelta.com/ - see more of my work
Go to top
Re: GLUT Samples ..
Quite a regular
Quite a regular


See User information
@Hans
Thank you.

What motivate me is to see on screen what I tried to do :) it's a method that generally makes me learn faster :p because I always want to do more and see more :)

I'll share my futures tests as tutorials for opengl :)

Kindest Regards,
Freddix

All we have to decide is what to do with the time that is given to us.
Go to top
Re: GLUT Samples ..
Home away from home
Home away from home


See User information
Any opengl book you'd recomend for a beginner?

X5000
Go to top
Re: GLUT Samples ..
Home away from home
Home away from home


See User information
@Antique

Quote:

Antique wrote:
Any opengl book you'd recomend for a beginner?


Have a look at my list of recommendations here. The Amazon stores allow you to have a look inside the books (the superbible at least) so you can decide if it's for you or not.

Hans

Join Kea Campus' Amiga Corner and support Amiga content creation
https://keasigmadelta.com/ - see more of my work
Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project