Who's Online |
73 user(s) are online ( 40 user(s) are browsing Forums)
Members: 1
Guests: 72
BSzili,
more...
|
|
|
|
Re: OpenGL - Small Stars scroll 4 layers.
|
Posted on: 2009/2/16 23:02
#641
|
Quite a regular
|
@Shadow: Do you think it should be the best to ask flush() to force emptying the queue and during this time, make other calculations that are not related to graphics ? and then use glutPostRedisplay() to update the display when everything is done ?
|
All we have to decide is what to do with the time that is given to us.
|
|
|
Re: OpenGL - Small Stars scroll 4 layers.
|
Posted on: 2009/2/16 22:54
#642
|
Quite a regular
|
@Shadow:
I've understood but, I noticed something, if I don't define a function for glutIdleFunc(). Nothing is updated on screen until I move or resize the window.
Strange... Issue ?
|
All we have to decide is what to do with the time that is given to us.
|
|
|
Re: OpenGL - Small Stars scroll 4 layers.
|
Posted on: 2009/2/16 22:32
#643
|
Quite a regular
|
@Shadow Ok
What is the difference between glutPostRedisplay() and glFlush() ?
|
All we have to decide is what to do with the time that is given to us.
|
|
|
Re: OpenGL - Small Stars scroll 4 layers.
|
Posted on: 2009/2/16 22:03
#644
|
Quite a regular
|
@Shadow ok
I'm new into C/C++ so I'm not perfect in understand the way the loops works with their limits :p
Thank you.
|
All we have to decide is what to do with the time that is given to us.
|
|
|
Re: OpenGL - Small Stars scroll 4 layers.
|
Posted on: 2009/2/16 21:49
#645
|
Quite a regular
|
@Shadow Yes, After releasing the code, I've optimised it a bit and it becomes this :
/* OpenGL Sample #1
SStar scrolling with 4 parallaxs
*/
#include <GL/glut.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
float PosXY[256][2];
/* WHAT WE WANT TO DISPLAY ON SCREEN MUST BE ADDED IN THIS FUNCTION */
void My_glRendering( void )
{
int i, multiplier;
glClearColor( 0.0, 0.0, 0.0, 0.0); /* Set backdrop as black */
glClear( GL_COLOR_BUFFER_BIT ); /* Clear the backdrop with glClearColor color */
glColor3f( 1.0, 1.0, 1.0 );
for( i = 0; i < 257 ; i++ ){
multiplier = i / 4.0;
PosXY[i][1] -= ( 0.00001f * multiplier ) ;
if ( PosXY[i][1] < 0.0 )
PosXY[i][1] = 1.0;
}
glBegin(GL_POINTS) ;
for( i = 00; i < 257 ; i++ ){
glVertex3f( PosXY[i][1], PosXY[i][2], 0.0f );
}
glEnd() ;
glFlush();
}
/* SOME INITIALIZATIONS HERE */
void My_glInit( void )
{
glMatrixMode( GL_PROJECTION );
glLoadIdentity() ;
glOrtho( 0.0, 1.0, 0.0, 1.0, -1.0, 1.0 );
}
/* MAIN C PROCEDURE STARTUP-SEQUENCE IS HERE */
int main(int argc, char** argv)
{
int i;
for( i = 1; i < 257 ; i++ ){
PosXY[i][1] = rand() % 100000 / 100000.0 ;
PosXY[i][2] = rand() % 100000 / 100000.0 ;
}
glutInit(&argc, argv); /* Initialize Glut */
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA); /* Define display mode properties such as single buffer, color mode and */
glutInitWindowSize( 640, 480 ); /* define the sizes of the window to create */
glutInitWindowPosition( 300, 300 );
glutCreateWindow("AmiDARK Test Window"); /* Create the final rendering window */
My_glInit();
glutDisplayFunc( My_glRendering );
glutIdleFunc( My_glRendering );
mglEnableSync(GL_TRUE );
glutMainLoop();
return 0;
}
|
All we have to decide is what to do with the time that is given to us.
|
|
|
OpenGL - Small Stars scroll 4 layers.
|
Posted on: 2009/2/16 20:38
#646
|
Quite a regular
|
Just 4 fun, I start learning C/C++ and OpenGL and I wanted to share my 1st small test as some sort of free tutorial for C/C++ OpenGL ... (I'm a true beginner in both C/C++ and OpenGL)
/* OpenGL Sample #1
SStar scrolling with 4 parallaxs
*/
#include <GL/glut.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
float PosXY[256][2];
/* WHAT WE WANT TO DISPLAY ON SCREEN MUST BE ADDED IN THIS FUNCTION */
void My_glRendering( void )
{
int i;
glClearColor( 0.0, 0.0, 0.0, 0.0); /* Set backdrop as black */
glClear( GL_COLOR_BUFFER_BIT ); /* Clear the backdrop with glClearColor color */
glColor3f( 1.0, 1.0, 1.0 );
for( i = 0; i < 257 ; i++ ){
PosXY[i][1] -= 0.0001f ;
if ( i < 64 )
PosXY[i][1] -= 0.0001f ;
if ( i < 128 )
PosXY[i][1] -= 0.0001f ;
if ( i < 192 )
PosXY[i][1] -= 0.0001f ;
if ( PosXY[i][1] <=0.0 )
PosXY[i][1] = 1.0;
glBegin(GL_POINTS) ;
glVertex3f( PosXY[i][1], PosXY[i][2], 0.0f );
glEnd() ;
}
glFlush();
}
/* SOME INITIALIZATIONS HERE */
void My_glInit( void )
{
glMatrixMode( GL_PROJECTION );
glLoadIdentity() ;
glOrtho( 0.0, 1.0, 0.0, 1.0, -1.0, 1.0 );
}
/* MAIN C PROCEDURE STARTUP-SEQUENCE IS HERE */
int main(int argc, char** argv)
{
int i;
for( i = 1; i < 257 ; i++ ){
PosXY[i][1] = rand() % 100000 / 100000.0 ;
PosXY[i][2] = rand() % 100000 / 100000.0 ;
}
glutInit(&argc, argv); /* Initialize Glut */
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); /* Define display mode properties such as single buffer, color mode and */
glutInitWindowSize( 640, 480 ); /* define the sizes of the window to create */
glutInitWindowPosition( 300, 300 );
glutCreateWindow("AmiDARK Test Window"); /* Create the final rendering window */
My_glInit();
glutDisplayFunc( My_glRendering );
glutIdleFunc( My_glRendering );
mglEnableSync(GL_TRUE );
glutMainLoop();
return 0;
}
Here is a small link (Rar file) that contain both source code and executable (and CodeBENCH project) to test : http://files.odyssey-creators.com/os4opengl/OpenGLStarsv1.rar
|
All we have to decide is what to do with the time that is given to us.
|
|
|
Re: New version of Quake (v2.21) available
|
Posted on: 2009/2/14 23:52
#647
|
Quite a regular
|
ah ! ok.
|
All we have to decide is what to do with the time that is given to us.
|
|
|
Re: New version of Quake (v2.21) available
|
Posted on: 2009/2/14 22:38
#648
|
Quite a regular
|
@COBRA We'll have just to wait that OS4Depot add it :p Thank you COBRA :)
|
All we have to decide is what to do with the time that is given to us.
|
|
|
Re: GLUT Samples ..
|
Posted on: 2009/2/13 20:33
#649
|
Quite a regular
|
@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.
|
|
|
Re: GLUT Samples ..
|
Posted on: 2009/2/13 18:12
#650
|
Quite a regular
|
@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_glRendering( void )
{
glClearColor( 0.0, 0.0, 0.0, 0.0); /* Set backdrop as black */
glClear( GL_COLOR_BUFFER_BIT ); /* Clear the backdrop with glClearColor color */
glColor3f( 1.0, 1.0, 1.0 );
glBegin(GL_POLYGON) ;
glVertex3f( 0.25, 0.25, 0.0 );
glVertex3f( 0.75, 0.25, 0.0 );
glVertex3f( 0.75, 0.75, 0.0 );
glVertex3f( 0.25, 0.75, 0.0 );
glEnd() ;
glFlush();
}
/* SOME INITIALIZATIONS HERE */
void My_glInit( void )
{
glMatrixMode( GL_PROJECTION );
glLoadIdentity() ;
glOrtho( 0.0, 1.0, 0.0, 1.0, -1.0, 1.0 );
}
/* MAIN C PROCEDURE STARTUP-SEQUENCE IS HERE */
int main(int argc, char** argv)
{
glutInit(&argc, argv); /* Initialize Glut */
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); /* Define display mode properties such as single buffer, color mode and */
glutInitWindowSize( 640, 480 ); /* define the sizes of the window to create */
glutInitWindowPosition( 300, 300 );
glutCreateWindow("AmiDARK Test Window"); /* Create the final rendering window */
My_glInit();
glutDisplayFunc( My_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.
|
|
|
Re: GLUT Samples ..
|
Posted on: 2009/2/13 0:08
#651
|
Quite a regular
|
@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.
|
|
|
GLUT Samples ..
|
Posted on: 2009/2/12 18:57
#652
|
Quite a regular
|
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.
|
|
|
Re: New version of Quake (v2.21) available
|
Posted on: 2009/2/12 13:51
#653
|
Quite a regular
|
@COBRA: Good job :) the game run fine on my SAM440EP...
However, I've noticed that 1280x1024 mode encounter display issue ... display is not stable in this resolution.
|
All we have to decide is what to do with the time that is given to us.
|
|
|
Re: Hans GL samples under OS 4.1 SDK 53.xx
|
Posted on: 2009/2/11 23:49
#654
|
Quite a regular
|
Ok.
I will wait then for the update and test the basic one ...
Kindest Regards Freddix
|
All we have to decide is what to do with the time that is given to us.
|
|
|
Re: Hans GL samples under OS 4.1 SDK 53.xx
|
Posted on: 2009/2/11 23:09
#655
|
Quite a regular
|
@Hans Thank you for these informations.
When I use your own MAKEFILE, I get less errors but errors occured. I tried both SHELL command MAKE and under CodeBENCH (same results)
With GLUT-FullScreen sample : gcc -mcrt=newlib -O3 -Wall -gstabs -DMINIGL -o GLUT-fullscreen.debug GLUT-fullscreen.o -lGL -lGLUT GLUT-fullscreen.o: In function `key': GLUT-fullscreen.c:152: undefined reference to `glutLeaveGameMode' GLUT-fullscreen.o: In function `animate': GLUT-fullscreen.c:102: undefined reference to `glutTimerFunc' GLUT-fullscreen.o: In function `reshape': /SDK/local/newlib/include/mgl/minigl.h:1323: undefined reference to `GLUPerspective' GLUT-fullscreen.o: In function `main': GLUT-fullscreen.c:49: undefined reference to `glutGameModeString' GLUT-fullscreen.c:50: undefined reference to `glutEnterGameMode' GLUT-fullscreen.c:61: undefined reference to `glutTimerFunc' make: *** [GLUT-fullscreen] Error 1
I modified nothing.
|
All we have to decide is what to do with the time that is given to us.
|
|
|
Re: Hans GL samples under OS 4.1 SDK 53.xx
|
Posted on: 2009/2/11 22:13
#656
|
Quite a regular
|
@Hans CodeBENCH create the MAKEFILE and compiles I tried both CodeBENCH and shell with MAKE ALL And I give the same result.
|
All we have to decide is what to do with the time that is given to us.
|
|
|
Re: Hans GL samples under OS 4.1 SDK 53.xx
|
Posted on: 2009/2/11 22:00
#657
|
Quite a regular
|
@ZeroG I created a new project under CodeBENCH, using GL_FullScreen.c sample.
Here is the compilation errors : SDK:gcc/bin/gcc -c GLUT-fullscreen.c -o GLUT-fullscreen.o -lauto -lraauto gcc: -lauto: linker input file unused because linking not done gcc: -lraauto: linker input file unused because linking not done SDK:gcc/bin/gcc GLUT-fullscreen.o -o GLUT-fullscreen.exe -lauto -lraauto GLUT-fullscreen.o: In function `main': GLUT-fullscreen.c:(.text+0x4c): undefined reference to `glutGameModeString' GLUT-fullscreen.c:(.text+0x50): undefined reference to `glutEnterGameMode' GLUT-fullscreen.c:(.text+0x9c): undefined reference to `glutTimerFunc' GLUT-fullscreen.o: In function `glutInit': GLUT-fullscreen.c:(.text+0xe2): undefined reference to `__glut_current_context' GLUT-fullscreen.c:(.text+0xe6): undefined reference to `__glut_current_context' GLUT-fullscreen.c:(.text+0xf2): undefined reference to `__glut_current_context' GLUT-fullscreen.c:(.text+0xf6): undefined reference to `__glut_current_context' GLUT-fullscreen.o: In function `glutInitDisplayMode': GLUT-fullscreen.c:(.text+0x13a): undefined reference to `__glut_current_context' GLUT-fullscreen.o:GLUT-fullscreen.c:(.text+0x13e): more undefined references to `__glut_current_context' follow GLUT-fullscreen.o: In function `glClearColor': GLUT-fullscreen.c:(.text+0x3fe): undefined reference to `mini_CurrentContext' GLUT-fullscreen.c:(.text+0x402): undefined reference to `mini_CurrentContext' GLUT-fullscreen.c:(.text+0x40e): undefined reference to `mini_CurrentContext' GLUT-fullscreen.c:(.text+0x412): undefined reference to `mini_CurrentContext' GLUT-fullscreen.o: In function `glEnable': GLUT-fullscreen.c:(.text+0x45e): undefined reference to `mini_CurrentContext' GLUT-fullscreen.o:GLUT-fullscreen.c:(.text+0x462): more undefined references to `mini_CurrentContext' follow GLUT-fullscreen.o: In function `gluPerspective': GLUT-fullscreen.c:(.text+0x670): undefined reference to `GLUPerspective' GLUT-fullscreen.o: In function `glMatrixMode': GLUT-fullscreen.c:(.text+0x6a6): undefined reference to `mini_CurrentContext' GLUT-fullscreen.c:(.text+0x6aa): undefined reference to `mini_CurrentContext' GLUT-fullscreen.c:(.text+0x6b6): undefined reference to `mini_CurrentContext' GLUT-fullscreen.c:(.text+0x6ba): undefined reference to `mini_CurrentContext' GLUT-fullscreen.o: In function `glLoadIdentity': GLUT-fullscreen.c:(.text+0x6f6): undefined reference to `mini_CurrentContext' GLUT-fullscreen.o:GLUT-fullscreen.c:(.text+0x6fa): more undefined references to `mini_CurrentContext' follow GLUT-fullscreen.o: In function `animate': GLUT-fullscreen.c:(.text+0x758): undefined reference to `glutTimerFunc' GLUT-fullscreen.o: In function `glTranslatef': GLUT-fullscreen.c:(.text+0x916): undefined reference to `mini_CurrentContext' GLUT-fullscreen.c:(.text+0x91a): undefined reference to `mini_CurrentContext' GLUT-fullscreen.c:(.text+0x926): undefined reference to `mini_CurrentContext' GLUT-fullscreen.c:(.text+0x92a): undefined reference to `mini_CurrentContext' GLUT-fullscreen.o: In function `glRotatef': GLUT-fullscreen.c:(.text+0x97e): undefined reference to `mini_CurrentContext' GLUT-fullscreen.o:GLUT-fullscreen.c:(.text+0x982): more undefined references to `mini_CurrentContext' follow GLUT-fullscreen.o: In function `glutSwapBuffers': GLUT-fullscreen.c:(.text+0xb5a): undefined reference to `__glut_current_context' GLUT-fullscreen.c:(.text+0xb5e): undefined reference to `__glut_current_context' GLUT-fullscreen.c:(.text+0xb6a): undefined reference to `__glut_current_context' GLUT-fullscreen.c:(.text+0xb6e): undefined reference to `__glut_current_context' GLUT-fullscreen.o: In function `glFlush': GLUT-fullscreen.c:(.text+0xba6): undefined reference to `mini_CurrentContext' GLUT-fullscreen.c:(.text+0xbaa): undefined reference to `mini_CurrentContext' GLUT-fullscreen.c:(.text+0xbb6): undefined reference to `mini_CurrentContext' GLUT-fullscreen.c:(.text+0xbba): undefined reference to `mini_CurrentContext' GLUT-fullscreen.o: In function `key': GLUT-fullscreen.c:(.text+0xc14): undefined reference to `glutLeaveGameMode' make: *** [GLUT-fullscreen.exe] Error 1
|
All we have to decide is what to do with the time that is given to us.
|
|
|
Hans GL samples under OS 4.1 SDK 53.xx
|
Posted on: 2009/2/11 21:51
#658
|
Quite a regular
|
Hi,
Does someone know how I can compile the HANS samples ? I've installed the miniGL, copied includes with the ones of the SDK and I always get 39 errors concerning "undefined reference" ...
Thank you.
|
All we have to decide is what to do with the time that is given to us.
|
|
|
[BUG] Source files support & AmigaOS4.1 53.xx
|
Posted on: 2009/2/11 19:05
#659
|
Quite a regular
|
Hi All,
I've noticed that when I create a new project, if I add source files in the project window at "Source FIles..." section, compilation gives me an error with "gcc: cannot specify -o with -c or -S with multiple files ...
Is this a bug or something I've forgotten to setup ?
[EDIT] : Forget, It was due to my project setup where 2 files did contain the same C code ... I re create a new project with only 1 .c file and no backup and all is now ok.
Regards, AmiDARK.
|
All we have to decide is what to do with the time that is given to us.
|
|
|
Re: SDK 53.xx and Code Bench
|
Posted on: 2009/2/11 16:57
#660
|
Quite a regular
|
@abalaban Thank you for these informations.
Now that I have added the option you said, the source code compile, create an executable and it work :) even under Code BENCH 0.8 :)
Thank you.
|
All we have to decide is what to do with the time that is given to us.
|
|
|